by simias · 5y ago · 0 comments
I'd also ask him to make "switch" break by default.
Then I'd go kill Hitler or something.
Probably a module/namespace system would be the biggest improvement.
I made Firefox's code base able to compile with -Wimplicit-fallthrough. About one hundred fall through cases needed to be annotated and about 2-3 were actual bugs (though minor).
switch (foo) {
case 1:
case 2:
/* common body */
break;
case 3:
/* body 3 */
break;
}
It's not cognitively hard to make an empty case body fallthrough to the next run, but include an implicit break at the end of every nontrivial body.Supporting Duff's Device is not a compelling feature to support--irreducible loops are basically going to destroy any hope of optimization you might accrue.
which is probably the case in 90% of all my switch'es. Worst use of a time machine ever.
From Algol's linage point of view, a very good outcome.
Many languages also support something like
case 1,2,4:
or even case 1-10, 20-22, 34:
That further decreases the need for falling through.That said, I'm more annoyed at C's design commitee to not being able to add new features such as having length-aware arrays in C in the language.
Also https://tvtropes.org/pmwiki/pmwiki.php/Main/HitlersTimeTrave...
A time traveler shouldn't have a limit on time to search, so this doesn't make sense as an objection to me.