Would you like signs with those chars?
Would you like signs with those chars?
Posted Nov 3, 2022 14:49 UTC (Thu) by welinder (guest, #4699)Parent article: Would you like signs with those chars?
> As a general rule, C integer types are signed unless specified otherwise;
True.
> short, int, long all work that way.
Ah, no. They mostly work that way.
"int" has unspecified signedness in the following code:
struct X {
int m : 8;
};
Luckily bitfields are rare enough that you can just always insist on specifying "unsigned int" or "signed int"
