Language (d)evolution
31, Jul, 2020A few days ago my colleague sent me an article on new C standard. I read it without any hope. The author admired inclusion of nullptr as an typesafe miracle (not noting that any decent C lib defines it as (void*)0, not C++’s 0). Maybe he like to be more verbose? The standardization of compiler’s custom attributes looks that the committee is really being bored. The most important defer feature is still absent, and the 20+ years of typeof operator life in several compilers is to less to be acknowledged.
There was also a note that K&R declarations (sic!) will not be supported any more. It really does not bother me, I accustomed to prototypes. But, I got inspired and searched for first real C standard. The C Programming Language by Kernighan and Ritchie. How, it look like back then?
It was simpler. Only 5 types char, short, int, float and double. And pointers to them, which also were notation to arrays. Structures cannot be accessed (moved) by value, but by reference or primitive member. The int type was default type (now at best you have warning when omitting) and pointers have the same size as int. There was no problem with casting pointer to int, there were no problem of implicit function declaration returning pointer, there was no problem with passing pointers into varargs or other non-prototype functions. There were no prototypes, there were no need for them in that language. The default promotions were really no-ops, and these were helpful, not esoteric. There were no UB, aliasing, volatile, restricted, void and other clowns. It was powerful assembly macro language. Even goto was safer as all parameters were initialized on the begin of function (no jump through uninitialized variable to clean_at_end: label). And it is really funny that somebody likes brevity of anonymous function arguments of a “new” standard:
int main(int, char *[]) {
return 0;
}
Back then you might just written:
main() {
}
(implicit int return type, unspecified arguments, and default return).
The many people talks about evolution of the languages (C, C - -, …). But, is there an real evolution? Evolution means there is a natural selection. Do unuseful features disappear? Do we type less to get the same goal? Do we have language that does not make us surprised in debugger, looking on another corner case?
- Posted by michal in
- Add a comment