News for hackers. Stuff that matters.
Re:Baby's First Garbage Collector by dllthomas on Sunday December 08, 2013 @10:19PM (#6872689)
In ordinary C, without a garbage collector, I'd be baffled to find an implementation where one could not:

    1) Cast a pointer to an integer of sufficient size.
    2) Xor that integer with another value.
    3) Xor the result with the same value.
    4) Cast back to a pointer.
    5) Dereference.
It's sufficiently corner-case that I am not certain what the standard says about it. In any event, pointers matter when coding in assembly, where language standards aren't even relevant.
Re:Baby's First Garbage Collector by aidenn0 on Sunday December 08, 2013 @11:10PM (#6872782)
That is actually allowed in the standard; it specifically says that casting a pointer to an integral type of sufficient size is a reversible operation (though it I'm not sure if this is not well defined: (int i[2]; (int )((int)i)+sizeof(int)
Re:Baby's First Garbage Collector by dllthomas on Sunday December 08, 2013 @11:20PM (#6872798)
Could you have a standards-conforming implementation where pointers were big-endian and other integral values little-endian? That would break your example code. I don't know of any architecture that would motivate that, of course...