Posts I'm finding warn that intptr_t and uintptr_t are not guaranteed by the standard to exist.
What would be an example of a platform that don't have intptr_t/uintptr_t?
Will a platform that doesn't define intptr_t define/not define something so I can detect this? INTPTR_MIN?
Conversation
I don't see anything in the C99 standard allowing intptr_t to not be defined, by the way.
3
4
Okay I feel like I'm losing my mind here. Per my strict reading of the C99 standard, uintptr_t is not required to be defined, but UINTPTR_MAX *is* required to be defined and gte 2^16-1, even though the type it describes might not exist
4
6
27
The amount of stuff C99 allows to be "implementation defined" borders on the ludicrous imho.
1
1
5
i like how it's technically ok for none of the uintN_t types to be defined!!
2
6
But whitequark, what if we need to write a C compiler for a purely hypothetical instruction set that, somehow, has no concept of or support for unsigned 32-bit values? what then huh?
1
5
*Me, immediately starting to game out writing an emscripten-like C-to-java compiler*
2
6
The way Java supports unsigned integers is that the types like int are for both signed and unsigned numbers. The +, - and * operators work for either signed or unsigned arithmetic. There are compareUnsigned, divideUnsigned, etc. for operations that are different. It's horrible.
1
2
Not sure how Java qualifies as a high level language. The one that always gets me is needing to use equals instead of == to compare objects, especially for strings. Many types forgot to override equals including arrays so you have Arrays.equals... but that uses equals in a loop.
So it doesn't work for multi-dimensional arrays, since equals is broken, so they have Array.deepEquals. Pretty nice example of one of the MANY ways that class inheritance is horrible.
Anyways, for signed/unsigned ints just need to accept that Java thinks that it's assembly code.
1
2
A little example: gist.github.com/thestinger/eaf. Division is rare and most literals are less than the signed max, so it's not usually that verbose. I find it incredibly painful to use because I'll keep forgetting that I can't use <, > or printing / string conversion. Fucking Java.
Most languages have a difference between reference equality and content equality



