diff options
author | Oskar <[email protected]> | 2024-08-29 13:27:45 +0200 |
---|---|---|
committer | Oskar <[email protected]> | 2024-08-29 13:27:45 +0200 |
commit | 743c47c671347a0ac0f8f64b7117b48c65bab073 (patch) | |
tree | 5e33efe7a3e4d6ba5a9a6ee34762e978b51cb6b3 /4p37.cpp | |
parent | 1208defdbc457a89c0d9aea3b8faf86b8492761f (diff) |
more
Diffstat (limited to '4p37.cpp')
-rw-r--r-- | 4p37.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/4p37.cpp b/4p37.cpp new file mode 100644 index 0000000..2b8b16f --- /dev/null +++ b/4p37.cpp @@ -0,0 +1,25 @@ +#include <iostream> + +/* + * + * 4.37 + * + * + */ + +int main () { + + char s = 'a'; // just a variable we can use the address for to make the program not segfault + int i = 0; + double d = 0; + const std::string *ps = nullptr; + char *pc = &s; + void *pv = &s; + pv = const_cast<std::string*>(ps); + i = static_cast<int>(*pc); + pv = static_cast<void*>(&d); + pc = static_cast<char*>(pv); + if(i || d) {} // stop compiler from complaining + + return 0; +} |