|
|
Log in / Subscribe / Register

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"


to post comments


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds