Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

chars are only signed on some platforms (x86, for one). On others they're unsigned (ARM, for one).

One knockon effect of this is that strcmp() will return different values on the two different platforms for UTF-8 strings (because 0xff > 32, but -1 < 32)...

Incidentally, I don't know if you know about intptr_t; it's an int large enough to put a pointer in losslessly. It's dead handy. (My current project involves a system with 16-bit ints, 32-bit long longs, and 20-bit pointers...)



I did not know that chars were unsigned on arm- interesting.

I try to be conservative with the definitions I use, so I'm worried that intptr_t might be too new.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: