Friday, August 19, 2022

C23 Is Finished

Björkus Dorkus (tweet):

What’s in C23? Well, it’s everything […] present in N3047.

[…]

The new constexpr keyword for C means you don’t have to guess at whether that is a constant expression, or hope your compiler’s optimizer or frontend is powerful enough to treat it like one to get the code generation you want if VLAs with other extensions are on-by-default. You are guaranteed that this object is a constant expression, and if it is not the compiler will loudly yell at you.

[…]

While default, plain compound literals have “block scope” (C) or “temporary r-value scope” (C++), with the new storage-class specification feature, you can control that.

[…]

Go read this to find out all about the feature and how much of a bloody pyrrhic victory [#embed] was.

[…]

nullptr and the associated nullptr_t type in <stddef.h> fixes that problem. You can specify nullptr, and it’s required to have the same underlying representation as the null pointer constant in char* or void* form. This means it will always be passed correctly, for all ABIs, and you won’t read garbage bits.

[…]

If you ever used __auto_type from GCC: this is that, with the name auto.

Previously:

2 Comments RSS · Twitter


God, why can't they just leave it alone? C is supposed to be simple and most of the new stuff is design-by-committee supplication to C++ with which the language is fundamentally incompatible idiomatically.


Sebby, like what? IMHO, the nullptr and constexpr additions are great and fix what are essentially bugs in the language.

Leave a Comment