News for hackers. Stuff that matters.
Re:C++ Hints by mikeash on Monday August 24, 2015 @12:48PM (#10111160)
There's some good stuff here.

I'd like to offer a critique of the proposed solution to casting pointers to integer types, though. The post suggests using uintptr_t or similar when manipulating pointer types, to avoid 64-bit troubles. For the particular case of adding a number of bytes to a pointer, I'd recommend using char* instead. That bypasses the whole question of "what integer type is big enough?" and helps avoid mistakes like accidentally dividing or multiplying the number, or passing it in to something that wants an integer.

There are no comments on this comment yet.