| Deutsch English Français Italiano |
|
<86ldxztzpk.fsf@linuxsc.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch <tr.17687@z991.linuxsc.com> Newsgroups: comp.lang.c Subject: Re: else ladders practice Date: Sun, 03 Nov 2024 20:00:55 -0800 Organization: A noiseless patient Spider Lines: 48 Message-ID: <86ldxztzpk.fsf@linuxsc.com> References: <3deb64c5b0ee344acd9fbaea1002baf7302c1e8f@i2pn2.org> <vg0t3j$2ruor$1@dont-email.me> <78eabb4054783e30968ae5ffafd6b4ff2e5a5f17@i2pn2.org> <864j4pv76h.fsf@linuxsc.com> <6726C97C.4080807@grunge.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Mon, 04 Nov 2024 05:00:59 +0100 (CET) Injection-Info: dont-email.me; posting-host="f359696380662fa6462481cb0fc8fe02"; logging-data="837986"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/JEpW+BzcoOeJQUD4cAjkgW0ly8SmsmNA=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:iFWKGds3lvUHvGc9uWk5off65HY= sha1:7hjOIic9FuWD+sQLSgRdYWkXmRI= Bytes: 3062 fir <fir@grunge.pl> writes: > Tim Rentsch wrote: > >> fir <fir@grunge.pl> writes: >> >>> Bart wrote: >>> >>>> ral clear patterns here: you're testing the same variable 'n' >>>> against several mutually exclusive alternatives, which also happen >>>> to be consecutive values. >>>> >>>> C is short of ways to express this, if you want to keep those >>>> 'somethings' as inline code (otherwise arrays of function pointers >>>> or even label pointers could be use >>> >>> so in short this groupo seem to have no conclusion but is tolerant >>> foir various approaches as it seems >>> >>> imo the else latder is like most proper but i dont lkie it >>> optically, swich case i also dont like (use as far i i remember >>> never in my code, for years dont use even one) >>> >>> so i persnally would use bare ifs and maybe elses ocasionally >>> (and switch should be mended but its fully not clear how, >> >> I think you should have confidence in your own opinion. All >> you're getting from other people is their opinion about what is >> easier to understand, or "clear", or "readable", etc. As long as >> the code is logically correct you are free to choose either >> style, and it's perfectly okay to choose the one that you find >> more appealing. >> >> There is a case where using 'else' is necessary, when there is a >> catchall action for circumstances matching "none of the above". >> Alternatively a 'break' or 'continue' or 'goto' or 'return' may >> be used to bypass subsequent cases, but you get the idea. >> >> With the understanding that I am offering more than my own opinion, >> I can say that I might use any of the patterns mentioned, depending >> on circumstances. I don't think any one approach is either always >> right or always wrong. > > maybe, but some may heve some strong arguments (for use this and not > that) i may overlook I acknowledge the point, but you haven't gotten any arguments, only opinions.