4 ms·
Interesting list of things to bash C and Algol-derived languages on. I really like Eevee's original approach of doing a comparative survey rather than talking a
by pjc50 10y ago
Interesting list of things to bash C and Algol-derived languages on. I really like Eevee's original approach of doing a comparative survey rather than talking about things in isolation. ( https://eev.ee/blog/2016/12/01/lets-stop-copying-c/ https://eev.ee/blog/2016/12/01/lets-stop-copying-c/ )
Point by point:
- textual inclusion and macros: yeah, this technology was obviously chosen for ease of implementation on small systems and makes little sense. Now obsolete and a handicap. Especially in C++.
- optional block delimiters: responsible for gotofail and similar errors.
- modulo: symptom of C not having standardised maths semantics. Standardise your semantics, language designers! Don't just say "whatever the CPU gives us, I'm sure it'll be fine".
- octal: Nobody uses goddam octal and it's a trap for people used to leading zeroes in decimal.
If we're changing this then I'd like to appeal for some features from Verilog e.g. 8'b1101_1101 : leading width specifier, and the internal underscore which is ignored but provides visual clarity.
- power operator: meh.
- switch: actual operation is kind of bananas, see Duff's device. Should be block-based.
- integer division: Careful. Huge argument here about maths.
(tbc)
- dom0 10y ago> - octal: Nobody uses goddam octal and it's a trap for people used to leading zeroes in decimal. 0b..., 0x..., 0o... the latter is still a bit subtle (0Oo), but far more distinct and far less likely to happen by accident. > - switch: actual operation is kind of bananas, see Duff's device. Should be block-based. the goto-table semantics of switch are kinda useful in many instances, OTOH a compiler should be smart enough today to achieve the same degree of rather simple optimization.
- JdeBP 10y ago> e.g. 8'b1101_1101 : leading width specifier, and the internal underscore which is ignored but provides visual clarity ... some of which were extensions provided by Metaware's High C/C++ compiler back in the 1990s: 0x2x1101_1011 0x10x_bad_feed_face 0_777