Как-то я пропустил эту статью от 28 февраля: https://thephd.dev/ever-closer-c23-improvements
Кратко о том что приняли нового в С23, и какие предложения отвергли. (в статье расписано более подробно)
Приняли:
- N2935
Make false and true first-class language features
- N2927
typeof
- N2653 N2828
char8_t
and Unicode Improvements! - N2900 Consistent, Warningless, and Intuitive Initialization with
= {}
- N2826
unreachable()
- N2829
Make assert() macro user friendly for C and C++
- N2432 N2841
K&R Function Declaration AND Definitions are 🪦
- N2808
allow 16-bit ptrdiff_t again
- N2778
Separating Variably-Modified Types from Variable Length Arrays
- N2775
Literal Suffixes for _BitInt(N) types
- N2701
@, $, and backtick are added to the source character set
- N2764
[[_Noreturn]]
- N2840
Make call_once mandatory
К сожалению часть предложений была отклонена от включения в С23:
- N2896
#once
and#once YOUR_GUARD_ID_HERE
, to reduce include guard spam - N2895 N2892 defer, Lambdas
- N2859
break break;, break continue;, break break continue;
- N2917
constexpr
Также хочу скопировать из статьи пояснения по поводу defer
и constexpr
defer, Lambdas, and similar were voted down, but still have consensus to proceed for a timeline beyond/after C23. I’ve personally volunteered to direct and maybe even steer the effort for Lambdas. defer might come along for the ride since it’s basically in the same vein when it comes to what variables are available for defer. Spoiler: we’re going to be pursuing barebones, simple defer that is block-scoped (to the nearest braces, or conditional/etc. if the braces are omitted). This is mostly to save us from making the same design mistake Go did, where they have a defer that may dynamically allocate (?! Jesus Christ!) or other complete nonsense.
other complete nonsense - ссылка на твит с таким текстом:
And this blocks
for i := 0; i < 100000; i++ {
mutex.Lock()
defer mutex.Unlock()
*counter += 1
}
Is there anything in Go that is not broken?
constexpr - an extremely watered down version compared to C++ that is super simple and deliberately intended not to be much more than updated ways of handling constants in C - did not die. There is strong support to work on it, albeit it might not make C23. Which is perfectly okay, as long as it stays alive!