Re: Official list of top C annoyances

Liste des GroupesRevenir à l c 
Sujet : Re: Official list of top C annoyances
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.c
Date : 09. Sep 2026, 23:13:08
Autres entêtes
Organisation : None to speak of
Message-ID : <117sllk$1g635$2@kst.eternal-september.org>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
User-Agent : Gnus/5.13 (Gnus v5.13)
Lane W <cactus_DAC@yahoo.com> writes:
David Brown wrote:
[...]
C's include system works well when used in a sensible and
disciplined manner, but unfortunately not all C programmers are
sensible and disciplined.
 
Agreed. Plus some C programmers use the switch keyword, which we all
agree is BAD BAD BAD, right Janis and Keith?

No, of course not.

David Brown already covered most of the points I was going to make,
and I agree with what he wrote in this subthread.

I initially ignored your code because it was in a thread I wasn't
particularly interested in.  I later decided to review it because
it was brought to my attention.

If you think I dislike the switch statement, you've reached a
completely incorrect and unjustified conclusion.

I dislike the particular code snippet that you posted, code
that happened to use a switch statement (inappropriately IMHO).
There are plenty of valid uses for switch statements, and I don't
hesitate to use it when it's appropriate.  It seemed to me that you
artificially added a layer of complexity so you could use a switch
statement rather than an if/else chain -- and to set that up, you
used a sequence of if statements (with no "else" for some reason).

My criticism of your code has nothing to do with the fact that you
wrote it.  To be blunt, I don't care enough about you personally to
go out of my way to nitpick your code.  I would have had similar
criticisms if the code had been posted by the late Dennis Ritchie
or by Brian Kernighan, though I would have been more reticent in
expressing my opinions.

The idea behind your code is not necessarily a bad one.
You transformed a floating-point input value partitioned into
ranges into a discrete value, with one discrete value corresponding
to each range.  That can be a useful technique.  For one thing,
it's an opportunity to give a meaningful name to each input range
(but you just used 1, 2, 3).  In some cases, it might allow fewer
floating-point operations to be performed before making a decision,
which could be significant in performance-critical code.

But your specific code in this specific case was not good.
Leaving out the extra transformation step would, in this case,
make the code clearer and more efficient.

In fact at work, I'm regularly known as __The Evil One__ because of my
propensity to use the switch construct.
>
Every company brochure shows my position as Sauron in the company
fables, with my signature golden ring. Pure evil, I guarantee it.

Dude, get over yourself.  Pretending to be persecuted because someone
criticized your code is not a good look.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */

Date Sujet#  Auteur
6 Sep 26 * Official list of top C annoyances396fir
6 Sep 26 +- Re: Official list of top C annoyances1fir
6 Sep 26 +* Re: Official list of top C annoyances368bart
6 Sep 26 i+* Re: Official list of top C annoyances366Janis Papanagnou
7 Sep 26 ii+* Re: Official list of top C annoyances362fir
7 Sep 26 iii`* Re: Official list of top C annoyances361bart
7 Sep 26 iii +* Re: Official list of top C annoyances359David Brown
7 Sep 26 iii i`* Re: Official list of top C annoyances358bart
7 Sep 26 iii i +- Re: Official list of top C annoyances1fir
7 Sep 26 iii i `* Re: Official list of top C annoyances356David Brown
7 Sep 26 iii i  +* Re: Official list of top C annoyances354bart
7 Sep 26 iii i  i+* Re: Official list of top C annoyances65Janis Papanagnou
8 Sep 26 iii i  ii+* Re: Official list of top C annoyances24bart
8 Sep 26 iii i  iii+* Re: Official list of top C annoyances6Lane W
8 Sep 26 iii i  iiii`* Re: Official list of top C annoyances5Keith Thompson
9 Sep 26 iii i  iiii `* Re: Official list of top C annoyances4fir
9 Sep 26 iii i  iiii  `* Re: Official list of top C annoyances3fir
9 Sep 26 iii i  iiii   `* Re: Official list of top C annoyances2fir
18 Sep08:38 iii i  iiii    `- Re: Official list of top C annoyances1fir
8 Sep 26 iii i  iii+- Re: Official list of top C annoyances1Janis Papanagnou
8 Sep 26 iii i  iii`* Re: Official list of top C annoyances16bart
9 Sep 26 iii i  iii +- Re: Official list of top C annoyances1Janis Papanagnou
9 Sep 26 iii i  iii `* Re: Official list of top C annoyances14David Brown
9 Sep 26 iii i  iii  `* Re: Official list of top C annoyances13bart
9 Sep 26 iii i  iii   `* Re: Official list of top C annoyances12David Brown
9 Sep 26 iii i  iii    `* Re: Official list of top C annoyances11bart
9 Sep 26 iii i  iii     `* Re: Official list of top C annoyances10David Brown
9 Sep 26 iii i  iii      `* Re: Official list of top C annoyances9bart
9 Sep 26 iii i  iii       +- Re: Official list of top C annoyances1bart
9 Sep 26 iii i  iii       +* Re: Official list of top C annoyances3David Brown
9 Sep 26 iii i  iii       i`* Re: Official list of top C annoyances2bart
10 Sep 26 iii i  iii       i `- Re: Official list of top C annoyances1David Brown
9 Sep 26 iii i  iii       +* Re: Official list of top C annoyances2Janis Papanagnou
9 Sep 26 iii i  iii       i`- Re: Official list of top C annoyances1Janis Papanagnou
9 Sep 26 iii i  iii       `* Re: Official list of top C annoyances2Keith Thompson
9 Sep 26 iii i  iii        `- Re: Official list of top C annoyances1bart
8 Sep 26 iii i  ii`* Re: Official list of top C annoyances40David Brown
9 Sep 26 iii i  ii `* Re: Official list of top C annoyances39Janis Papanagnou
9 Sep 26 iii i  ii  `* Re: Official list of top C annoyances38David Brown
9 Sep 26 iii i  ii   +* Re: Official list of top C annoyances7Janis Papanagnou
9 Sep 26 iii i  ii   i`* Re: Official list of top C annoyances6David Brown
10 Sep 26 iii i  ii   i `* Re: Official list of top C annoyances5Chris M. Thomasson
10 Sep 26 iii i  ii   i  +- Re: Official list of top C annoyances1Chris M. Thomasson
11 Sep 26 iii i  ii   i  +- Re: Official list of top C annoyances1David Brown
14 Sep 26 iii i  ii   i  `* Re: Official list of top C annoyances2Kaz Kylheku
18 Sep16:29 iii i  ii   i   `- Re: Official list of top C annoyances1Tim Rentsch
9 Sep 26 iii i  ii   `* Re: Official list of top C annoyances30Keith Thompson
9 Sep 26 iii i  ii    +* Re: Official list of top C annoyances26David Brown
9 Sep 26 iii i  ii    i`* Re: Official list of top C annoyances25Lane W
9 Sep 26 iii i  ii    i +* Re: Official list of top C annoyances23David Brown
9 Sep 26 iii i  ii    i i+* Re: Official list of top C annoyances8Lane W
9 Sep 26 iii i  ii    i ii+* Re: Official list of top C annoyances6fir
9 Sep 26 iii i  ii    i iii+* Re: Official list of top C annoyances3Lane W
9 Sep 26 iii i  ii    i iiii+- Re: Official list of top C annoyances1fir
10 Sep 26 iii i  ii    i iiii`- Re: Official list of top C annoyances1Keith Thompson
9 Sep 26 iii i  ii    i iii`* Re: Official list of top C annoyances2fir
9 Sep 26 iii i  ii    i iii `- Re: Official list of top C annoyances1fir
9 Sep 26 iii i  ii    i ii`- Re: Official list of top C annoyances1David Brown
9 Sep 26 iii i  ii    i i+* Re: Official list of top C annoyances13bart
9 Sep 26 iii i  ii    i ii`* Re: Official list of top C annoyances12Lane W
9 Sep 26 iii i  ii    i ii +* Re: Official list of top C annoyances9bart
9 Sep 26 iii i  ii    i ii i+* Re: Official list of top C annoyances6fir
9 Sep 26 iii i  ii    i ii ii+* Re: Official list of top C annoyances4fir
9 Sep 26 iii i  ii    i ii iii`* Re: Official list of top C annoyances3fir
9 Sep 26 iii i  ii    i ii iii `* Re: Official list of top C annoyances2fir
9 Sep 26 iii i  ii    i ii iii  `- Re: Official list of top C annoyances1fir
9 Sep 26 iii i  ii    i ii ii`- Re: Official list of top C annoyances1fir
9 Sep 26 iii i  ii    i ii i+- Re: Official list of top C annoyances1bart
10 Sep 26 iii i  ii    i ii i`- Re: Official list of top C annoyances1David Brown
9 Sep 26 iii i  ii    i ii +- Re: Official list of top C annoyances1David Brown
9 Sep 26 iii i  ii    i ii `- Re: Official list of top C annoyances1Keith Thompson
10 Sep 26 iii i  ii    i i`- Re: Official list of top C annoyances1Janis Papanagnou
9 Sep 26 iii i  ii    i `- Re: Official list of top C annoyances1Keith Thompson
9 Sep 26 iii i  ii    `* Re: Official list of top C annoyances3Richard Harnden
9 Sep 26 iii i  ii     +- Re: Official list of top C annoyances1Keith Thompson
10 Sep 26 iii i  ii     `- Re: Official list of top C annoyances1Janis Papanagnou
8 Sep 26 iii i  i`* Re: Official list of top C annoyances288Waldek Hebisch
8 Sep 26 iii i  i `* Re: Official list of top C annoyances287bart
9 Sep 26 iii i  i  +* Re: Official list of top C annoyances269Waldek Hebisch
9 Sep 26 iii i  i  i+- Re: Official list of top C annoyances1Janis Papanagnou
9 Sep 26 iii i  i  i`* Re: Official list of top C annoyances267bart
9 Sep 26 iii i  i  i +- Re: Official list of top C annoyances1tTh
9 Sep 26 iii i  i  i +* Re: Official list of top C annoyances3David Brown
9 Sep 26 iii i  i  i i`* Re: Official list of top C annoyances2bart
10 Sep 26 iii i  i  i i `- Re: Official list of top C annoyances1David Brown
9 Sep 26 iii i  i  i +* Re: Official list of top C annoyances121Janis Papanagnou
9 Sep 26 iii i  i  i i`* Re: Official list of top C annoyances120bart
10 Sep 26 iii i  i  i i +* Re: Official list of top C annoyances41Janis Papanagnou
10 Sep 26 iii i  i  i i i`* Re: Official list of top C annoyances40bart
10 Sep 26 iii i  i  i i i `* Re: Official list of top C annoyances39fir
10 Sep 26 iii i  i  i i i  +* Re: Official list of top C annoyances3fir
10 Sep 26 iii i  i  i i i  i`* Re: Official list of top C annoyances2fir
10 Sep 26 iii i  i  i i i  i `- Re: Official list of top C annoyances1fir
10 Sep 26 iii i  i  i i i  `* Re: Official list of top C annoyances35bart
10 Sep 26 iii i  i  i i i   +- Re: Official list of top C annoyances1fir
10 Sep 26 iii i  i  i i i   `* Re: Official list of top C annoyances33fir
10 Sep 26 iii i  i  i i i    +* Re: Official list of top C annoyances31bart
10 Sep 26 iii i  i  i i i    i+* Re: Official list of top C annoyances5fir
10 Sep 26 iii i  i  i i i    ii`* Re: Official list of top C annoyances4fir
10 Sep 26 iii i  i  i i i    ii `* Re: Official list of top C annoyances3bart
10 Sep 26 iii i  i  i i i    ii  `* Re: Official list of top C annoyances2fir
10 Sep 26 iii i  i  i i i    i`* Re: Official list of top C annoyances25fir
10 Sep 26 iii i  i  i i i    `- Re: Official list of top C annoyances1fir
10 Sep 26 iii i  i  i i `* Re: Official list of top C annoyances78David Brown
13 Sep 26 iii i  i  i `* Re: Official list of top C annoyances141Waldek Hebisch
9 Sep 26 iii i  i  `* Re: Official list of top C annoyances17Janis Papanagnou
8 Sep 26 iii i  `- Re: Official list of top C annoyances1Chris M. Thomasson
7 Sep 26 iii `- Re: Official list of top C annoyances1fir
7 Sep 26 ii`* Re: Official list of top C annoyances3David Brown
7 Sep 26 i`- Re: Official list of top C annoyances1Chris M. Thomasson
7 Sep 26 +- Re: Official list of top C annoyances1fir
8 Sep 26 `* Re: Official list of top C annoyances25fir

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal