feat: nullptr type
This commit is contained in:
parent
0c3fcbe9f8
commit
4a615cd7aa
@ -6,3 +6,5 @@
|
||||
#define VERSION_TWEAK @PROJECT_VERSION_TWEAK @
|
||||
|
||||
#define VERSION "@PROJECT_VERSION@"
|
||||
|
||||
#define PROJECT_NAME "@PROJECT_NAME@"
|
||||
|
30
src/main.cpp
30
src/main.cpp
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user