This is a short overview of things added along with c11 and c23 which I find
useful or interesting.
auto keyword… yet again
auto has been repurposed in C23. Originally, it defined a storage
duration for local
variables (similarly as static) now, comparably as in C++, it can be used for type inference purposes.
1
2
3
4
5
6
7
|
void foo() {
// auto is implied
int i = 123;
// same thing, auto keyword is redundant
auto int j = 123;
}
|
In its original purpose, variables marked with auto have their storage automatically allocated and
deallocated on scope entry and exit. It was implied for all local, stack
variables. No one really used auto explicitly because it was just
unnecessary now, it has an extra meaning.