Products > Programming
New C23 working draft
newbrain:
I know only a subset of a minority of a segment will be interested, but a new working draft for what is supposed to become C23 has been published on open-std.org the 8th of June.
You can find it here.
Quite a number of proposals have been included, from the top of my head:
- Remove K&R style function declarations
- Mandatory 2's complement representation for integers.
- Binary literals with 0b or 0B
- Digit separation character ' in literals as in 123'456'789
- unreachable() macro
- Optional VLAs (as in C17 and C11 but not C99) but mandatory variably modified types (change)
jeremy:
Thank you for sharing, there are indeed a few of us out here interested in this stuff. I'm glad to see that C (and C++) are getting some effort put into them, I just hope the compliers catch up quickly.
SiliconWizard:
Yup, I've been keeping an eye on this too.
Haven't seen a lot of significant changes though apart from some sugar coating and removing obsolete constructs.
The binary literals are cool but nothing groundbreaking (I've actually never used them even with compilers supporting them as an extension, I find them hard to read and easy to fuck up), the digit separation is nice though, but nothing essential.
The mandatory 2's complement triggers a "finally!" reaction, but while it's important for compiler writers and standardization, in practice, all C compilers I've ever dealt with used 2's complement. So...
All in all, nothing big really. IMHO.
I'm still waiting for the support of "modules" in C. And also maybe some better support for generic programming - as long as it's kept simple, we don't want C to become C++.
As a question, I wonder what is the use of variably modified types if VLAs are not supported. Could you explain?
newbrain:
--- Quote ---Could you explain?
--- End quote ---
I could, but then I'd have to kill you.
Jokes aside, IIUC, a vmt can be used as a function parameter, the actual argument can be a regular array.
This comes handy to pass multidimensional arrays without pointer contortions and it's a really welcome improvement..
See, e.g., Example 4 at the bottom of page 118.
Other things:
- bool, true, false (so bool.h is not needed to use them), static_assert, alignas, alignof are now first class keywords.
- the set of reserved identifier has been relaxed.
Though everyone was doing that, me included, it was strictly speaking UB to use identifier such as strength, EMPLOYEE, total and so on, due to 7.31 that reserved a vast number of prefixes for "future library use" (for the examples: str to E). They are now only "potentially" reserved.
Note that I'm not talking about the more commonly known (double) underscore prefixed ones.
EtA:
--- Quote ---I find them hard to read and easy to fuck up
--- End quote ---
Same here! (Apart for me eschewing extensions as much as possible).
But now, with the introduction of the digit separator, they become much more usable!
SiliconWizard:
--- Quote from: newbrain on June 12, 2022, 10:17:25 pm ---
--- Quote ---Could you explain?
--- End quote ---
I could, but then I'd have to kill you.
Jokes aside, IIUC, a vmt can be used as a function parameter, the actual argument can be a regular array.
This comes handy to pass multidimensional arrays without pointer contortions and it's a really welcome improvement..
--- End quote ---
OK, so as I thought, there's no other cases of VMT in C at the moment than arrays with unspecified size. I can see the point, but I admit I absolutely never use array types as function parameters, and indexing a "multi-dimensional array" is kinda trivial, but why not.
Otherwise, yeah, the rest looks like sugar coating. So after 20 odd years of C99, they now feel safe to add 'bool' as a keyword instead of _Bool (and so on). Great.
Navigation
[0] Message Index
[#] Next page
Go to full version