From 4a615cd7aa9bb3607746192cd816065af98acce2 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Wed, 18 Oct 2023 09:15:40 +0200 Subject: [PATCH] feat: nullptr type --- include/version.h.in | 10 ++++++---- src/main.cpp | 30 +++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/include/version.h.in b/include/version.h.in index b7e9740..5b10626 100644 --- a/include/version.h.in +++ b/include/version.h.in @@ -1,8 +1,10 @@ #pragma once -#define VERSION_MAJOR @PROJECT_VERSION_MAJOR@ -#define VERSION_MINOR @PROJECT_VERSION_MINOR@ -#define VERSION_PATCH @PROJECT_VERSION_PATCH@ -#define VERSION_TWEAK @PROJECT_VERSION_TWEAK@ +#define VERSION_MAJOR @PROJECT_VERSION_MAJOR @ +#define VERSION_MINOR @PROJECT_VERSION_MINOR @ +#define VERSION_PATCH @PROJECT_VERSION_PATCH @ +#define VERSION_TWEAK @PROJECT_VERSION_TWEAK @ #define VERSION "@PROJECT_VERSION@" + +#define PROJECT_NAME "@PROJECT_NAME@" diff --git a/src/main.cpp b/src/main.cpp index 36a4aa5..3298d6a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,10 +1,38 @@ #include #include +#include #include "version.h" +void call_test(char *) { std::cout << "call_test(char *) called" << std::endl; } + +void call_test(int) { std::cout << "call_test(int) called" << std::endl; } + int main(int argc, char **argv) { - std::cout << "Hello, world! Version " << VERSION << std::endl; + + std::cout << "Running " << PROJECT_NAME << ", version " << VERSION << "\n" + << std::endl; + + if (std::is_same::value) { + std::cout << "NULL == 0" << std::endl; + } + + if (std::is_same::value) { + std::cout << "NULL == (void *)0" << std::endl; + } + + if (std::is_same::value) { + std::cout << "NULL == __null" << std::endl; + } + + if (std::is_same::value) { + std::cout << "NULL == nullptr" << std::endl; + } + + call_test(0); + call_test(nullptr); + + std::cout << "\nExiting" << std::endl; return EXIT_SUCCESS; }