Cesium
Cesium copied to clipboard
Is `_Bool` a primitive type?
Right now, we have a following line in CTypeSystem.cs:
public IType Bool { get; } = new PrimitiveType(PrimitiveTypeKind.Int);
I'm not sure about that. In CLI, Bool's size is one byte, not four.
We'll have to check the standard to see whether _Bool is a primitive type we may use instead of PrimitiveTypeKind.Int here.
See // TODO[#179] in the code to fix this issue.
According to the C17 Language Standard Draft referenced in your readme:
For each of the signed integer types, there is a corresponding (but different) unsigned integer type (designated with the keyword unsigned) that uses the same amount of storage (including sign information) and has the same alignment requirements. The type
_Booland the unsigned integer types that correspond to the standard signed integer types are the standard unsigned integer types.
(Section 6.2.5, paragraph 6; page 31)
As I understood from here _Bool is a different unsigned integer type, but it corresponds with the standard unsigned integer type. Given this, I see no more suitable primitive type in Cesium than UnsignedInt.
So, there is the question: would we like to replace Int with UnsignedInt for better correspondence with the standard?
P.S. Sorry if I'm talking nonsense, I'm just getting started with your library <3
As I understood from here _Bool is a different unsigned integer type, but it corresponds with the standard unsigned integer type.
Except there's no mention of "the standard unsigned integer type" in that paragraph. There are "the unsigned integer
types", a plural. So, I don't think that this part of the standard actually talks about the unsigned int (in C notation). It just tells us there's an unsigned integer type named _Bool.
Well, as I read it, at least.