Proposal: Try to write a C compiler that violates programmers' expectations in the most extreme way possible while still being std compliant
-
-
Replying to @mcclure111
Too easy. More interesting if you constrain to POSIX's requirements & 2s complement. Then you have to find subtle stuff.
1 reply 0 retweets 2 likes -
Replying to @RichFelker @mcclure111
size_t is two bytes, void* is 4, but function pointers are 8
2 replies 0 retweets 0 likes -
Replying to @simrob @RichFelker
i've been working lately with emscripten where function pointers-- for an actually legitimate reason-- are not numbers
1 reply 0 retweets 3 likes -
Replying to @mcclure111 @simrob
At best/worst they're a really big number, because C has Representation of Types.
1 reply 0 retweets 0 likes -
Replying to @RichFelker @mcclure111
I thought intptr_t's existence and casts was implementation defined - maybe it's in POSIX?
1 reply 0 retweets 0 likes -
Replying to @simrob @mcclure111
Even without intptr_t, you have the representation of the pointer, an overlaid unsigned char[sizeof(T*)]...
2 replies 0 retweets 1 like -
...which you can interpret as a big number consisting of sizeof(T*)*CHAR_BIT binary digits.
1 reply 0 retweets 0 likes -
This doesn't imply any algebraic correspondence between pointer arithmetic & arithmetic on the representation...
1 reply 0 retweets 0 likes -
...but it does mean you can round-trip ptrs through arbitrarily-obfuscating intermediates, including over-wire or crypto
1 reply 0 retweets 0 likes
printf/scanf %p can also do that.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.