feat: nullptr type
This commit is contained in:
parent
0c3fcbe9f8
commit
4a615cd7aa
2 changed files with 35 additions and 5 deletions
|
@ -1,8 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define VERSION_MAJOR @PROJECT_VERSION_MAJOR@
|
#define VERSION_MAJOR @PROJECT_VERSION_MAJOR @
|
||||||
#define VERSION_MINOR @PROJECT_VERSION_MINOR@
|
#define VERSION_MINOR @PROJECT_VERSION_MINOR @
|
||||||
#define VERSION_PATCH @PROJECT_VERSION_PATCH@
|
#define VERSION_PATCH @PROJECT_VERSION_PATCH @
|
||||||
#define VERSION_TWEAK @PROJECT_VERSION_TWEAK@
|
#define VERSION_TWEAK @PROJECT_VERSION_TWEAK @
|
||||||
|
|
||||||
#define VERSION "@PROJECT_VERSION@"
|
#define VERSION "@PROJECT_VERSION@"
|
||||||
|
|
||||||
|
#define PROJECT_NAME "@PROJECT_NAME@"
|
||||||
|
|
30
src/main.cpp
30
src/main.cpp
|
@ -1,10 +1,38 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
#include "version.h"
|
#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) {
|
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;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue