It is possible to find architectures where the char data type is represented on 8 bytes,
I don't know any. BTW, it is not only a matter of architecture, but also of ABI. BTW, you don't define what is a byte, and the bit size of char
-s matters much more.
(IIRC, someone coded a weird implementation of C in Common Lisp on Linux/x86-64 which has 32 bits char
-s; of course its ABI is not the usual Linux one!)
sizeof(char)
=1 all the time. My question is, what is the value of sizeof(long long)
and sizeof(int)
on such an architecture ?
It probably would be also 1 (assuming char
, int
, long long
all have 64 bits) unless long long
is e.g. 128 bits (which is possible but unusual).
Notice that the C standard imposes minimal bounds and bit sizes (read n1570). E.g. long long
could be wider than 64 bits. I never heard of such C implementations (and I hope that when 128 bits processors become common, C will be dead).
But your question is theoretical. I know no practical C implementation with 64 bits char
-s or wider than 64 bits long long
. In practice assuming that char
-s are 8 bits (but they could be signed
or unsigned
, and both exist) is a reasonable, but non universal, assumption.
Notice that C is not a universal programming language. You won't be able to code a C compiler for a ternary machine like Setun.