Mercurial > thymian
comparison 3rdparty/vmime/cmake/cmake-cxx11/Tests/Module/CXX11Features/cxx11features.cxx @ 0:a4671277546c tip
created the repository for the thymian project
| author | ferencd |
|---|---|
| date | Tue, 17 Aug 2021 11:19:54 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:a4671277546c |
|---|---|
| 1 #if defined(HAS_CXX0X_CSTDINT_H) | |
| 2 #include <cstdint> | |
| 3 #endif | |
| 4 | |
| 5 #include <sys/types.h> | |
| 6 | |
| 7 struct thing { | |
| 8 unsigned char one; | |
| 9 #if defined(HAS_CXX0X_CSTDINT_H) | |
| 10 uint32_t four; | |
| 11 #endif | |
| 12 #if defined(HAS_CXX0X_LONG_LONG) | |
| 13 long long eight; | |
| 14 #endif | |
| 15 }; | |
| 16 | |
| 17 #include <stdio.h> | |
| 18 | |
| 19 int main() | |
| 20 { | |
| 21 #if defined (HAS_CXX0X_NULLPTR) | |
| 22 void *nix = nullptr; | |
| 23 #else /* HAS_CXX0X_NULLPTR */ | |
| 24 void *nix = 0; | |
| 25 #endif /* HAS_CXX0X_NULLPTR */ | |
| 26 | |
| 27 #if defined(HAS_CXX0X_STATIC_ASSERT) | |
| 28 static_assert(1 < 42, "Your C++ compiler is b0rked"); | |
| 29 #endif /* HAS_CXX0X_STATIC_ASSERT */ | |
| 30 | |
| 31 #if defined(HAS_CXX0X_FUNC) | |
| 32 const char *funcname = __func__; | |
| 33 printf("the name of main() function is: %s\n", funcname); | |
| 34 #endif /* HAS_CXX0X_FUNC */ | |
| 35 | |
| 36 #if defined(HAS_CXX0X_SIZEOF_MEMBER) | |
| 37 size_t onesize = sizeof(thing::one); | |
| 38 #if defined(HAS_CXX0X_STATIC_ASSERT) | |
| 39 static_assert(sizeof(thing::one) == 1, "Your char is not one byte long"); | |
| 40 #endif /* HAS_CXX0X_STATIC_ASSERT */ | |
| 41 | |
| 42 #if defined(HAS_CXX0X_CSTDINT_H) | |
| 43 size_t foursize = sizeof(thing::four); | |
| 44 #if defined(HAS_CXX0X_STATIC_ASSERT) | |
| 45 static_assert(sizeof(thing::four) == 4, "Your uint32_t is not 32 bit long"); | |
| 46 #endif /* HAS_CXX0X_STATIC_ASSERT */ | |
| 47 #endif /* HAS_CXX0X_CSTDINT_H */ | |
| 48 #if defined(HAS_CXX0X_LONG_LONG) | |
| 49 size_t eightsize = sizeof(thing::eight); | |
| 50 #if defined(HAS_CXX0X_STATIC_ASSERT) | |
| 51 static_assert(sizeof(thing::eight) == 8, "Your long long is not 64 bit long"); | |
| 52 #endif /* HAS_CXX0X_STATIC_ASSERT */ | |
| 53 #endif /* HAS_CXX0X_LONG_LONG */ | |
| 54 #endif /* HAS_CXX0X_SIZEOF_MEMBER */ | |
| 55 | |
| 56 return 0; | |
| 57 } |
