I think this is an interesting change, even though I (as someone who has loved C for 30+ years and use it daily in a professional capacity) don't immediately see a lot of use-cases I'm sure they can be found as the author demonstrates. Cool, and a good post!
Surac•45m ago
i fear this will make slopy code compile more often OK.
ioasuncvinvaer•29m ago
Can you give an example?
rwmj•40m ago
Slighty off-topic, why is he using ptrdiff_t (instead of size_t) for the cap & len types?
r1chardnl•18m ago
From one of his other blogposts. "Guidelines for computing sizes and subscripts"
Never mix unsigned and signed operands. Prefer signed. If you need to convert an operand, see (2).
The recent #def #enddef proposal[1] would eliminate the need for backslashes to define readable macros, making this pattern much more pleasant, finger crossed for its inclusion in C2Y!
It seems as though this makes it impossible to do the new-type paradigm in C23 ? If Goose and Beaver differ only in their name, C now thinks they're the same type so too bad we can tell a Beaver to fly even though we deliberately required a Goose ?
unwind•1h ago