Proposed patch to replace if(0) obfuscation with explicit gotos. 🤔
Looks sufficiently non-invasive and like a significant improvement to readability.
Proposed patch to replace if(0) obfuscation with explicit gotos. 🤔
Looks sufficiently non-invasive and like a significant improvement to readability.
@datarama No need to convince me. I don't have anything against gotos. I think the original code was just an exercise in "look, this can be done without gotos!" and highlighting how case statements are really labels not blocks.
But it's a perpetual source of "musl printf is hideous and unreadable!" complaints that detract from what's otherwise (hey I might be biased but I think this is fair) the best printf implementation out there.
@dalias I've used gotos much like this in lexers, and a few other state machines. When what you actually mean is "nonrecoverably transfer control to somewhere else", they're often the best you can do for readability in a langauge that doesn't have tail-call optimization.
@dalias I never thought I would've said that, but please use gotos! :D
@Gottox switch statements are gotos anyway. 🙃
@dalias It's a misconception that `goto`s must not be used. There are usecases - especially in C which lacks the 'defer' statement - where it's just needed to write non-awful code.
GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.
All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.