- Binary constants are allowed using the 0b prefix.
- The c and s suffixes are added for char and short constants. Can be used with u.
- Strong checking, mixing types always gives errors (not warnings).
- No integer promotion mechanism, mixing types is forbidden without explicit casts.
- Sign-extension and truncation is only done through casts.
- Casts are mandatory for constants assigned to derived types.
- Constant suffixes or casts are mandatory for everything but "int".
- Bool is a base type not compatible with integer types without an explicit cast, it can be assigned with true/false or the result of comparison operators.
- The words true and false are actual keywords not macros.
- Comparison operators explicitly return a bool.
- Conditional statements if, do, while, for ( ; condition; ) explicitly require a bool.
There are several restrictions:
- Assigning pointers to different pointer types is an error.
- Comparing pointers with different pointer types is an error.
- A cast between pointers is possible only if the two pointers are "related", meaning that one pointer points to an ancestor type of the other type.
- The void type is considered ancestor to all types. It is always possible to cast from/to a pointer to void.
- Constants can be assigned to pointers using casts but only if the constant is compatible with the pointed type alignment constraints.
- The void type has no alignment constraints. If you NEED to create an unaligned pointer then cast it first to void* then to the final pointer type.