Namespaces
Variants

Talk:c/language/arithmetic types

From cppreference.com

why does arithmetic types page not talking about enum?

isn't type enum compatible with integer?

They have their own page at c/language/enum. You can get there from this page by following the link in "(See also type for type system overview " and the link to enumerated types from there. --Cubbi (talk)

Page says int and char can be the same size, is that right?

If int and char are the same size, then fgetc() doesn't make sense. unsigned char uses a pure binary representation (no padding bits, all n = CHAR_BIT bits are value bits), so there are 2**n byte values that fgetc() might need to return. But if int is the same size, there are only 2**n int values, which leaves no spare value for EOF. EOF would be ambiguous with a byte that could exist in the input.

AMC (talk) 17:59, 17 July 2022 (PDT)

char and int can be the same size, but int must be at least 16 bits: there are plenty of values in that range that aren't valid char values. A less contrived version of this problem can be seen in the wchar_t/wint_t pair. --Cubbi (talk) 19:45, 17 July 2022 (PDT)