Ask HN: What extension would you like to see in the next C standard?
What else would you like to see in the next revision of the C programming language?
What else would you like to see in the next revision of the C programming language?
- "goto case" and "goto default"
- Using ?: with nothing in between, like GNU C does. This is a feature I often use.
This goto case extension would be, if you write "goto default" inside of a switch block, then it go to the default label, and if you write "goto case" and an expression, it evaluate the expression and go to the case label that matches the result, or to default if there isn't a match.
The ?: with nothing in between is documented in the GNU documentation, although I can also explain here: If whatever is before the question mark is true then that value is used (without evaluating it twice); if false, then instead whatever is after the colon will be used.
I really hope they approve the following:
* auto
* constexpr
* lambda function
* __typeof__ used as typeof; it behaves like decltype
It would lead to cleaner code without excessive macro magic; only where would be needed.[1] https://gustedt.wordpress.com/2020/12/14/a-defer-mechanism-f...
(I’m looking for honest dialogue and not trying to be combative)
Function overloading and default parameters. They're just too nice not to have.
Closures and lambdas (mentioned)