Rewrite some of the macros in a way that:
a) makes them more likely to trigger compile-time errors if used
inappropriately, and
b) makes C++ compilers happy
Don't include <stdint.h>, it's not available when compiling with MSVC
2008 and we don't need it in the first place - just cast the argument
to `char *` rather than `uintptr_t`.
Fixes#893.
QUEUE_DATA used to cast a pointer to long and back to pointer. This can
corrupt pointers on systems where the long type isn't large enough to
store pointer, like Windows x64. This commit fixes that.
Fixes#835