1
0

feat: nullptr type

This commit is contained in:
mandlm 2023-10-18 09:15:40 +02:00
parent 0c3fcbe9f8
commit 4a615cd7aa
Signed by: mandlm
GPG Key ID: 4AA25D647AA54CC7
2 changed files with 35 additions and 5 deletions

View File

@ -6,3 +6,5 @@
#define VERSION_TWEAK @PROJECT_VERSION_TWEAK @
#define VERSION "@PROJECT_VERSION@"
#define PROJECT_NAME "@PROJECT_NAME@"

View File

@ -1,10 +1,38 @@
#include <cstdlib>
#include <iostream>
#include <type_traits>
#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<decltype(NULL), decltype(0)>::value) {
std::cout << "NULL == 0" << std::endl;
}
if (std::is_same<decltype(NULL), decltype((void *)0)>::value) {
std::cout << "NULL == (void *)0" << std::endl;
}
if (std::is_same<decltype(NULL), decltype(__null)>::value) {
std::cout << "NULL == __null" << std::endl;
}
if (std::is_same<decltype(NULL), std::nullptr_t>::value) {
std::cout << "NULL == nullptr" << std::endl;
}
call_test(0);
call_test(nullptr);
std::cout << "\nExiting" << std::endl;
return EXIT_SUCCESS;
}