Comment by jstimpfle
2 years ago
Exactly this. There are no literals in C that create composite types. There are no composite types inherent to the language. All these types are defined in (system) includes.
And zero-terminated strings are not strictly worse than other length-prefixed string forms. They save some space -- sure, less relevant today -- as well as provide an in-band termination signal -- which is hacky, again sure, but it is convenient when looking at a hex dump for example.
There are literals that create composite types, since C99: https://en.cppreference.com/w/c/language/compound_literal
> There are no literals in C that create composite types
Float/double literals do
how so?
Because a float contains bit fields including sign of the exponent, sign, mantissa, sign of the mantissa. It's a bit of a pedantic argument but technically it makes sense.
7 replies →