Re:C2x: the next real revision of the C standard
by pjmlp on Monday November 12, 2018 @04:24PM
(#18435989)
Better go through the standards then, both of them have introduced breaking changes in their revisions.
I can gladly provide a couple of examples.
Re:C2x: the next real revision of the C standard
by dymk on Monday November 12, 2018 @10:39PM
(#18438354)
Please do provide examples.
Revisions to the C and C++ have almost never broken meaningful backwards compatibility, at least at the language semantics level.
Re:C2x: the next real revision of the C standard
by pjmlp on Tuesday November 13, 2018 @02:21AM
(#18439263)
Besides what nrclark has written on his/her comment, C11 dropped gets() and the introduction of the new memory model in C11 might break code that was relying on CPU specific semantics not in synch with it.
Regarding C++:
- auto changed its meaning on C++11
- export templates were removed in C++11
- exception specifications were deprecated in C++11, removed in C++17 and might do a come back in C++23 with value based exceptions
- gets() got removed in C++11
- declspec and auto had a small semantic difference, settled in C++17
- initializer lists introduced in C++11 changed their auto deduction type in C++17
- the required implementation semantics for std::string in C++11 broke COW in compilers like GCC.
Just a small list, there are a couple more.
Re:C2x: the next real revision of the C standard
by nrclark on Monday November 12, 2018 @11:21PM
(#18438567)
C's variable-length arrays are one example. They were introduced in C99, and downgraded to 'optional' in C11. So that's one place where a newer C compiler could refuse old C code and still be language compliant.
Also the draft C2x standard does away with K&R declarations, which will be another compatibility break.
Adding simple abstractions which don't hide complexity in the underlying assembly is a huge productivity and correctness boost. Not that it matters anyways; modern optimizers are always going to do things that absolutely bend your brain.
Wouldn't that be nice if you could use a `scope(exit) {}` instead of accidentally missing two or three `goto cleanup_7;` which result in an RCE?
I would absolutely love a standards-compliant way to scope-guard sections of code. It'd make huge swaths of C code simpler; it's even in enough demand that Clang and GCC implement as their own extensions.