Created
July 13, 2016 23:46
-
-
Save vobject/1c2916ffa833a98aff2a91f62fadc30f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
struct C {}; | |
C* f() { return (C*)0x80000000; } | |
C* b() { return (C*)0x70000000; } | |
int main() | |
{ | |
uint64_t f1 = (uint32_t)f(); | |
uint64_t f2 = (uint64_t)f(); | |
uint64_t f3 = (uint64_t)(uint32_t)f(); | |
uint64_t f4 = (uint64_t)0x80000000; | |
cout << hex << showbase << "f1="<<f1 << " f2="<<f2 << " f3="<<f3 << " f4="<<f4 << endl; | |
uint64_t b1 = (uint32_t)b(); | |
uint64_t b2 = (uint64_t)b(); | |
uint64_t b3 = (uint64_t)(uint32_t)b(); | |
uint64_t b4 = (uint64_t)0x70000000; | |
cout << hex << showbase << "b1="<<b1 << " b2="<<b2 << " b3="<<b3 << " b4="<<b4 << endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://webcompiler.cloudapp.net/