iirc, in the MS x86-64 compiler, long is 32bits (not 64)I'm pretty sure even Microsofts x86_64 compiler doesn't do this. It's very common to have long long always 64-bit and the long type as whatever the native type of the processor is. They would both be 64-bit then, which this line forbids.
adding pointers portably (in C)
Hm... ok, it would still imply (and make you think) that GCC isn't compliant with C/C++, where it really is.JAAman wrote:iirc, in the MS x86-64 compiler, long is 32bits (not 64)I'm pretty sure even Microsofts x86_64 compiler doesn't do this. It's very common to have long long always 64-bit and the long type as whatever the native type of the processor is. They would both be 64-bit then, which this line forbids.
Just a small note on the original topic, you can add them portably by casting them to intptr_t and adding them. There's just a small catch, why add two pointers? In all cases you have an object at a given location and an index into the object, you never add the location of one object to the location of another.
You can have slightly more complex ones, where A=B+C-D or such, but in that case C-D would be a ptrdiff_t and you can logically add a ptrdiff_t to an intptr_t to get another intptr_t.
Why do you want to add two pointers?