Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #41668 > unrolled thread

Is goto Still Considered Harmful?

Started byLynn McGuire <lmc@winsim.com>
First post2014-03-12 11:02 -0500
Last post2014-03-29 05:56 -0700
Articles 20 on this page of 149 — 45 participants

Back to article view | Back to comp.lang.c


Contents

  Is goto Still Considered Harmful? Lynn McGuire <lmc@winsim.com> - 2014-03-12 11:02 -0500
    Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-03-12 12:17 -0400
    Re: Is goto Still Considered Harmful? nospam@see.signature (Richard Maine) - 2014-03-12 09:20 -0700
      Re: Is goto Still Considered Harmful? Lynn McGuire <lmc@winsim.com> - 2014-03-18 16:30 -0500
        Re: Is goto Still Considered Harmful? Geoff <geoff@invalid.invalid> - 2014-03-18 17:36 -0700
          Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-03-19 07:34 -0400
            Re: Is goto Still Considered Harmful? "BartC" <bc@freeuk.com> - 2014-03-19 12:08 +0000
              Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-03-19 10:07 -0400
                Re: Is goto Still Considered Harmful? Richard <rgrdev_@gmail.com> - 2014-03-19 17:05 +0100
              Re: Is goto Still Considered Harmful? Lynn McGuire <lmc@winsim.com> - 2014-03-19 12:27 -0500
        Re: Is goto Still Considered Harmful? "Terence" <tbwright@bigpond.net.au> - 2014-03-19 20:35 +1100
          Re: Is goto Still Considered Harmful? Lynn McGuire <lmc@winsim.com> - 2014-03-19 12:26 -0500
    Re: Is goto Still Considered Harmful? Kaz Kylheku <kaz@kylheku.com> - 2014-03-12 16:47 +0000
      Re: Is goto Still Considered Harmful? Jos Bergervoet <jos.bergervoet@xs4all.nl> - 2014-03-12 19:07 +0100
        Re: Is goto Still Considered Harmful? Andrew Cooper <root@127.0.0.1> - 2014-03-12 23:36 +0000
          Re: Is goto Still Considered Harmful? Kaz Kylheku <kaz@kylheku.com> - 2014-03-13 00:23 +0000
            Re: Is goto Still Considered Harmful? Andrew Cooper <root@127.0.0.1> - 2014-03-13 01:18 +0000
              Re: Is goto Still Considered Harmful? Kaz Kylheku <kaz@kylheku.com> - 2014-03-13 02:08 +0000
                Re: Is goto Still Considered Harmful? Andrew Cooper <root@127.0.0.1> - 2014-03-13 02:21 +0000
                Re: Is goto Still Considered Harmful? David Brown <david.brown@hesbynett.no> - 2014-03-13 11:17 +0100
          Re: Is goto Still Considered Harmful? Melzzzzz <mel@zzzzz.invalid> - 2014-03-13 01:53 +0100
        Re: Is goto Still Considered Harmful? Les Cargill <lcargill99@comcast.com> - 2014-03-13 01:46 -0500
      Re: Is goto Still Considered Harmful? Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-03-13 10:56 +0100
      Re: Is goto Still Considered Harmful? "Nasser M. Abbasi" <nma@12000.org> - 2014-03-16 08:18 -0500
        Re: Is goto Still Considered Harmful? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-03-16 15:18 +0000
          Re: Is goto Still Considered Harmful? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-03-20 11:36 -0700
    Re: Is goto Still Considered Harmful? "BartC" <bc@freeuk.com> - 2014-03-12 18:50 +0000
      Re: Is goto Still Considered Harmful? <william@wilbur.25thandClement.com> - 2014-03-12 12:49 -0700
      Re: Is goto Still Considered Harmful? "Qolin" <noone@nowhere.com> - 2014-03-12 21:54 +0000
        Re: Is goto Still Considered Harmful? Lynn McGuire <lmc@winsim.com> - 2014-03-12 16:57 -0500
        Re: Is goto Still Considered Harmful? Keith Thompson <kst-u@mib.org> - 2014-03-12 15:36 -0700
          Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-03-12 19:02 -0400
            Re: Is goto Still Considered Harmful? Keith Thompson <kst-u@mib.org> - 2014-03-12 16:58 -0700
              Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-03-12 20:09 -0400
          Re: Is goto Still Considered Harmful? Keith Thompson <kst-u@mib.org> - 2014-03-12 16:44 -0700
        Re: Is goto Still Considered Harmful? Robert Wessel <robertwessel2@yahoo.com> - 2014-03-12 23:40 -0500
          Re: Is goto Still Considered Harmful? David Brown <david.brown@hesbynett.no> - 2014-03-13 11:25 +0100
          Re: Is goto Still Considered Harmful? Thomas Jahns <jahns@idontlikespam.dkrz.de> - 2014-03-14 11:24 +0100
            Re: Is goto Still Considered Harmful? Robert Wessel <robertwessel2@yahoo.com> - 2014-03-14 23:32 -0500
            Re: Is goto Still Considered Harmful? Dr Nick <nospam-4@temporary-address.org.uk> - 2014-03-15 13:43 +0000
              Re: Is goto Still Considered Harmful? David Brown <david.brown@hesbynett.no> - 2014-03-15 16:28 +0100
                Re: Is goto Still Considered Harmful? Dr Nick <nospam-4@temporary-address.org.uk> - 2014-03-15 16:01 +0000
                  Re: Is goto Still Considered Harmful? David Brown <david.brown@hesbynett.no> - 2014-03-17 08:51 +0100
      Re: Is goto Still Considered Harmful? David Brown <david.brown@hesbynett.no> - 2014-03-13 11:22 +0100
    Re: Is goto Still Considered Harmful? ralph <nt_consulting@yahoo.com> - 2014-03-12 15:34 -0500
    Re: Is goto Still Considered Harmful? "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2014-03-12 17:48 -0700
    Re: Is goto Still Considered Harmful? jt@toerring.de (Jens Thoms Toerring) - 2014-03-13 01:06 +0000
      Re: Is goto Still Considered Harmful? wilson <winslole@udayton.edu> - 2014-03-13 03:59 -0400
        Re: Is goto Still Considered Harmful? wilson <winslole@udayton.edu> - 2014-03-13 05:02 -0400
          Re: Is goto Still Considered Harmful? Richard Damon <Richard@Damon-Family.org> - 2014-03-13 08:42 -0400
            Re: Is goto Still Considered Harmful? gazelle@shell.xmission.com (Kenny McCormack) - 2014-03-13 14:45 +0000
      Re: Is goto Still Considered Harmful? Louis Krupp <lkrupp@nospam.pssw.com.invalid> - 2014-03-13 07:42 -0600
        Re: Is goto Still Considered Harmful? Richard <rgrdev_@gmail.com> - 2014-03-13 14:56 +0100
    Re: Is goto Still Considered Harmful? Wolfgang Kilian <kilian@invalid.com> - 2014-03-13 09:10 +0100
    Re: Is goto Still Considered Harmful? mark.bluemel@gmail.com - 2014-03-13 08:02 -0700
    Re: Is goto Still Considered Harmful? Thomas Koenig <tkoenig@netcologne.de> - 2014-03-13 21:09 +0000
      Re: Is goto Still Considered Harmful? "Qolin" <noone@nowhere.com> - 2014-03-13 21:24 +0000
        Re: Is goto Still Considered Harmful? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-03-13 22:36 +0000
          Re: Is goto Still Considered Harmful? Robert Wessel <robertwessel2@yahoo.com> - 2014-03-13 23:02 -0500
            Re: Is goto Still Considered Harmful? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-03-14 04:07 +0000
              Re: Is goto Still Considered Harmful? Robert Wessel <robertwessel2@yahoo.com> - 2014-03-13 23:56 -0500
            Re: Is goto Still Considered Harmful? helbig@astro.multiCLOTHESvax.de (Phillip Helbig---undress to reply) - 2014-03-14 09:17 +0000
      Re: Is goto Still Considered Harmful? Kaz Kylheku <kaz@kylheku.com> - 2014-03-13 22:42 +0000
        Re: Is goto Still Considered Harmful? "James Van Buskirk" <not_valid@comcast.net> - 2014-03-13 17:13 -0600
          Re: Is goto Still Considered Harmful? Keith Thompson <kst-u@mib.org> - 2014-03-13 16:46 -0700
            Re: Is goto Still Considered Harmful? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-03-14 01:17 +0000
              Re: Is goto Still Considered Harmful? Robert Wessel <robertwessel2@yahoo.com> - 2014-03-13 23:04 -0500
                Re: Is goto Still Considered Harmful? David Brown <david.brown@hesbynett.no> - 2014-03-14 10:41 +0100
                  Re: Is goto Still Considered Harmful? Kaz Kylheku <kaz@kylheku.com> - 2014-03-14 09:55 +0000
                    Re: Is goto Still Considered Harmful? David Brown <david.brown@hesbynett.no> - 2014-03-14 13:16 +0100
                    Re: Is goto Still Considered Harmful? Seebs <usenet-nospam@seebs.net> - 2014-03-18 21:08 +0000
                      Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-03-18 17:41 -0400
          Re: Is goto Still Considered Harmful? Kaz Kylheku <kaz@kylheku.com> - 2014-03-14 00:45 +0000
            Re: Is goto Still Considered Harmful? "James Van Buskirk" <not_valid@comcast.net> - 2014-03-13 21:40 -0600
              Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-03-14 01:02 -0400
                Re: Is goto Still Considered Harmful? "James Van Buskirk" <not_valid@comcast.net> - 2014-03-14 10:36 -0600
                  Re: Is goto Still Considered Harmful? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-03-14 17:30 +0000
                  Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-03-14 13:51 -0400
                    Re: Is goto Still Considered Harmful? Keith Thompson <kst-u@mib.org> - 2014-03-14 13:12 -0700
                  Re: Is goto Still Considered Harmful? Tim Rentsch <txr@alumni.caltech.edu> - 2014-03-29 06:46 -0700
              Re: Is goto Still Considered Harmful? Kaz Kylheku <kaz@kylheku.com> - 2014-03-14 05:29 +0000
                Re: Is goto Still Considered Harmful? "James Van Buskirk" <not_valid@comcast.net> - 2014-03-14 10:47 -0600
                  Re: Is goto Still Considered Harmful? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-03-14 17:43 +0000
                  Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-03-14 13:52 -0400
              Re: Is goto Still Considered Harmful? Stephen Sprunk <stephen@sprunk.org> - 2014-03-16 17:15 -0500
                Re: Is goto Still Considered Harmful? Keith Thompson <kst-u@mib.org> - 2014-03-16 16:04 -0700
      Re: Is goto Still Considered Harmful? Kaz Kylheku <kaz@kylheku.com> - 2014-03-14 05:11 +0000
        Re: Is goto Still Considered Harmful? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-03-14 06:00 +0000
    Re: Is goto Still Considered Harmful? "Terence" <tbwright@bigpond.net.au> - 2014-03-14 08:32 +1100
      Re: Is goto Still Considered Harmful? Richard Damon <Richard@Damon-Family.org> - 2014-03-14 23:10 -0400
    Re: Is goto Still Considered Harmful? Rosario193 <Rosario@invalid.invalid> - 2014-03-14 02:18 +0100
      Re: Is goto Still Considered Harmful? Lynn McGuire <lmc@winsim.com> - 2014-03-18 16:14 -0500
    Re: Is goto Still Considered Harmful? John Bode <jfbode1029@gmail.com> - 2014-03-24 07:52 -0700
      Re: Is goto Still Considered Harmful? Ken Brody <kenbrody@spamcop.net> - 2014-03-24 11:20 -0400
        Re: Is goto Still Considered Harmful? "BartC" <bc@freeuk.com> - 2014-03-24 17:08 +0000
        Re: Is goto Still Considered Harmful? Ken Brody <kenbrody@spamcop.net> - 2014-03-25 14:06 -0400
          Re: Is goto Still Considered Harmful? Lowell Gilbert <lgusenet@be-well.ilk.org> - 2014-03-26 13:31 -0400
      Re: Is goto Still Considered Harmful? gazelle@shell.xmission.com (Kenny McCormack) - 2014-03-24 16:31 +0000
      Re: Is goto Still Considered Harmful? "BartC" <bc@freeuk.com> - 2014-03-24 16:46 +0000
        Re: Is goto Still Considered Harmful? John Bode <jfbode1029@gmail.com> - 2014-03-24 16:10 -0700
          Re: Is goto Still Considered Harmful? Keith Thompson <kst-u@mib.org> - 2014-03-24 17:19 -0700
            Re: Is goto Still Considered Harmful? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-03-25 02:56 -0700
            Re: Is goto Still Considered Harmful? Keith Thompson <kst-u@mib.org> - 2014-03-25 07:34 -0700
              Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-03-25 10:57 -0400
                Re: Is goto Still Considered Harmful? gazelle@shell.xmission.com (Kenny McCormack) - 2014-03-25 16:09 +0000
                Re: Is goto Still Considered Harmful? Kaz Kylheku <kaz@kylheku.com> - 2014-03-25 16:14 +0000
                  Re: Is goto Still Considered Harmful? Ian Collins <ian-news@hotmail.com> - 2014-03-26 08:06 +1300
                  Re: Is goto Still Considered Harmful? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-03-25 12:49 -0700
                  Re: Is goto Still Considered Harmful? Stephen Sprunk <stephen@sprunk.org> - 2014-03-31 14:05 -0500
                    Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-03-31 15:20 -0400
                      Re: Is goto Still Considered Harmful? Stephen Sprunk <stephen@sprunk.org> - 2014-04-04 14:56 -0500
                        Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-04-04 17:11 -0400
                          Re: Is goto Still Considered Harmful? Ian Collins <ian-news@hotmail.com> - 2014-04-05 12:03 +1300
                          Re: Is goto Still Considered Harmful? ralph <nt_consulting@yahoo.com> - 2014-04-05 00:17 -0500
                            Re: Is goto Still Considered Harmful? Ian Collins <ian-news@hotmail.com> - 2014-04-05 20:14 +1300
                          Re: Is goto Still Considered Harmful? Stephen Sprunk <stephen@sprunk.org> - 2014-04-09 14:30 -0500
                            Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-04-09 16:37 -0400
                              Re: Is goto Still Considered Harmful? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-04-09 14:01 -0700
                        Re: Is goto Still Considered Harmful? Richard <rgrdev_@gmail.com> - 2014-04-05 15:21 +0100
                    Re: Is goto Still Considered Harmful? Ian Collins <ian-news@hotmail.com> - 2014-04-01 11:04 +1300
                      Re: Is goto Still Considered Harmful? Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2014-04-01 02:45 +0300
                        Re: Is goto Still Considered Harmful? Ian Collins <ian-news@hotmail.com> - 2014-04-01 13:03 +1300
                          Re: Is goto Still Considered Harmful? Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2014-05-22 12:01 +0300
                            Re: Is goto Still Considered Harmful? Ian Collins <ian-news@hotmail.com> - 2014-05-22 21:22 +1200
                        Re: Is goto Still Considered Harmful? Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2014-05-22 11:53 +0300
                Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-03-31 12:10 -0400
                  Re: Is goto Still Considered Harmful? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-03-31 10:39 -0700
                    Re: Is goto Still Considered Harmful? Stephen Sprunk <stephen@sprunk.org> - 2014-03-31 13:42 -0500
                      Re: Is goto Still Considered Harmful? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-03-31 15:16 -0700
                        Re: Is goto Still Considered Harmful? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-04-01 00:24 -0700
                          Re: Is goto Still Considered Harmful? Richard Damon <Richard@Damon-Family.org> - 2014-04-01 08:26 -0400
                            Re: Is goto Still Considered Harmful? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-04-01 06:50 -0700
                              Re: Are setters Stil Considered Harmful? (was: Is goto Still Considered Harmful?) Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-04-02 10:49 -0700
              Re: Is goto Still Considered Harmful? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-03-25 19:30 +0000
                Re: Is goto Still Considered Harmful? Ken Brody <kenbrody@spamcop.net> - 2014-03-27 09:33 -0400
              Re: Is goto Still Considered Harmful? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-03-25 19:37 +0000
          Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-03-25 00:30 -0400
          Re: Is goto Still Considered Harmful? John Bode <jfbode1029@gmail.com> - 2014-03-27 11:47 -0700
            Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-03-27 20:39 -0400
              Re: Is goto Still Considered Harmful? gazelle@shell.xmission.com (Kenny McCormack) - 2014-03-28 01:40 +0000
            Re: Is goto Still Considered Harmful? Richard <rgrdev_@gmail.com> - 2014-03-28 10:09 +0100
              Re: Is goto Still Considered Harmful? gazelle@shell.xmission.com (Kenny McCormack) - 2014-03-28 09:48 +0000
              Re: Is goto Still Considered Harmful? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-03-28 03:24 -0700
                Re: Is goto Still Considered Harmful? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-03-28 18:52 +0000
                Re: Is goto Still Considered Harmful? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-03-30 02:45 -0700
      Re: Is goto Still Considered Harmful? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-03-24 12:53 -0700
      Re: Is goto Still Considered Harmful? John Bode <jfbode1029@gmail.com> - 2014-03-24 15:02 -0700
        Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-03-24 19:11 -0400
    Re: Is goto Still Considered Harmful? Tim Rentsch <txr@alumni.caltech.edu> - 2014-03-29 05:56 -0700

Page 2 of 8 — ← Prev page 1 [2] 3 4 5 6 7 8  Next page →


#41708

FromMelzzzzz <mel@zzzzz.invalid>
Date2014-03-13 01:53 +0100
Message-ID<lfqvic$tsm$20@solani.org>
In reply to#41701
On Wed, 12 Mar 2014 23:36:12 +0000
Andrew Cooper <root@127.0.0.1> wrote:

> On 12/03/2014 18:07, Jos Bergervoet wrote:
> > On 3/12/2014 5:47 PM, Kaz Kylheku wrote:
> >> On 2014-03-12, Lynn McGuire<lmc@winsim.com>  wrote:
> >>> Is goto Still Considered Harmful?
> >>>
> >>> http://www.drdobbs.com/architecture-and-design/is-goto-still-considered-harmful/240166595
> >>>
> >>
> >> It never was.
> > 
> > In your dreams, perhaps.
> 
> Only in your narrow view of the world then...
> 
> > 
> >   ...
> >> A large block with a nest of gotos going every which way is the
> >> most efficient
> >> way to compile state machines, or at least certain ones.
> > 
> > So gotos are efficient in machine code, but the
> > discussion wasn't about efficient machine code.
> 
> 
> gotos are about all you have in most machine languages.  And it is
> always more efficient not to use them; branch predictors aren't
> perfect.

Well they are not perfect but eg x86 have simple rule.
Forward branch is predicted not to be taken, while backward
branch is predicted to be taken.


-- 
Click OK to continue...

[toc] | [prev] | [next] | [standalone]


#41718

FromLes Cargill <lcargill99@comcast.com>
Date2014-03-13 01:46 -0500
Message-ID<lfrk0j$tvv$1@dont-email.me>
In reply to#41674
Jos Bergervoet wrote:
> On 3/12/2014 5:47 PM, Kaz Kylheku wrote:
>> On 2014-03-12, Lynn McGuire<lmc@winsim.com>  wrote:
>>> Is goto Still Considered Harmful?
>>>
>>> http://www.drdobbs.com/architecture-and-design/is-goto-still-considered-harmful/240166595
>>>
>>
>> It never was.
>
> In your dreams, perhaps.
>
>    ...
>> A large block with a nest of gotos going every which way is the most
>> efficient
>> way to compile state machines, or at least certain ones.
>
> So gotos are efficient in machine code, but the
> discussion wasn't about efficient machine code.
>

The problem with gotos is that they break the ... symmetry of
if.. then...else trees. They are "blue wires". That means it's
perceived to be a hack.

That, and that grad students who grade labs can grep for them.

Using gotos to implement state logic means you're not really
in the land of if...then...else trees any more.

>   ...
>> If you embrace imperative programming, you're embracing goto.
>
> No, you can still avoid them completely (although
> there's no need to goto such an extreme effort..)
> And of course keeping things functional will always
> pay off!
>


Functional is great if you can trust it and you're not
dependent on pseudo-emergent side effects.

Still, Lisp has been described as "fingernail  clippings
in oatmeal."

-- 
Les Cargill

[toc] | [prev] | [next] | [standalone]


#41729

FromJohannes Bauer <dfnsonfsduifb@gmx.de>
Date2014-03-13 10:56 +0100
Message-ID<lfrvc5$d4p$1@news.albasani.net>
In reply to#41672
On 12.03.2014 17:47, Kaz Kylheku wrote:

> He also invented semaphores, which are the worst synchronization primitive
> ever: and, ironicaly, can be considered to be "the goto of synchronization".

Although widely off-topic, I find this statement curious. Contrary to
you, I think semaphores are a great improvement over code that uses
mutexes and condition variables (which I would agree are the "goto of
synchronization") and yet they're small enough for deeply embedded
environments (where monitors or other fancy stuff is not feasible). Plus
they're really easy to understand ("counter").

Why the dislike of semaphores? Not looking for a flame here, but just
really trying to understand where you're coming from.

Cheers,
Joe

-- 
>> Wo hattest Du das Beben nochmal GENAU vorhergesagt?
> Zumindest nicht öffentlich!
Ah, der neueste und bis heute genialste Streich unsere großen
Kosmologen: Die Geheim-Vorhersage.
 - Karl Kaos über Rüdiger Thomas in dsa <hidbv3$om2$1@speranza.aioe.org>

[toc] | [prev] | [next] | [standalone]


#41892

From"Nasser M. Abbasi" <nma@12000.org>
Date2014-03-16 08:18 -0500
Message-ID<lg48aa$svn$1@speranza.aioe.org>
In reply to#41672
On 3/12/2014 11:47 AM, Kaz Kylheku wrote:
> On 2014-03-12, Lynn McGuire <lmc@winsim.com> wrote:
>> Is goto Still Considered Harmful?
>>
>> http://www.drdobbs.com/architecture-and-design/is-goto-still-considered-harmful/240166595
>
> It never was.
>
> Remember, Dijkstra wasn't an actual developer.  He never worked on any software
> project of consequence.  (Oh, pardon me, the THE system.)
>

I would guess that this is the case of almost all computer science
professors.

--Nasser

[toc] | [prev] | [next] | [standalone]


#41893

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2014-03-16 15:18 +0000
Message-ID<0.baaab86910865a374b7a.20140316151805GMT.87mwgq41g2.fsf@bsb.me.uk>
In reply to#41892
"Nasser M. Abbasi" <nma@12000.org> writes:

> On 3/12/2014 11:47 AM, Kaz Kylheku wrote:
>> On 2014-03-12, Lynn McGuire <lmc@winsim.com> wrote:
>>> Is goto Still Considered Harmful?
>>>
>>> http://www.drdobbs.com/architecture-and-design/is-goto-still-considered-harmful/240166595
>>
>> It never was.
>>
>> Remember, Dijkstra wasn't an actual developer.  He never worked on
>> any software project of consequence.  (Oh, pardon me, the THE
>> system.)
>
> I would guess that this is the case of almost all computer science
> professors.

I think you might be surprised, though you can always make it true by
judicious definition of "consequence".  The objectives of software
developed as part of a research project and those of software developed
for use "in the wild" are different, but both are of consequence.

-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#42024

FromMalcolm McLean <malcolm.mclean5@btinternet.com>
Date2014-03-20 11:36 -0700
Message-ID<e5448e74-a115-4e2a-857d-f52ddcf04b6a@googlegroups.com>
In reply to#41893
On Sunday, March 16, 2014 4:04:53 PM UTC, Stefan Ram wrote:
> 
>   Persons change from research jobs into non-research jobs. 
>   Google, Microsoft and Sun had all hired people known for
>   their research in programming languages and, in the other
>   directions, practioners become researchers or teachers.
>
Higher education is done by people with research interests. So it's natural
for the final stages of higher education to consist partly or wholly of
research. Most people then move on to jobs outside the academic sector.

[toc] | [prev] | [next] | [standalone]


#41675

From"BartC" <bc@freeuk.com>
Date2014-03-12 18:50 +0000
Message-ID<D02Uu.48537$if6.16488@fx07.am4>
In reply to#41668

"Lynn McGuire" <lmc@winsim.com> wrote in message
news:lfq0fp$4dp$1@dont-email.me...
> Is goto Still Considered Harmful?
>
> http://www.drdobbs.com/architecture-and-design/is-goto-still-considered-harmful/240166595

Yes it is frowned upon and it is bad practice. But I'd prefer that a
language still has it just in case (many don't; C does, otherwise I wouldn't
be here - I need it for auto-generated code).

But the code error in the article was about how code blocks are delimited:

 if (a)
   b;
   c;
 if (d) ...

Statements b and c are both indented and look at first glance as though they
belong to the preceding if-condition, but c (which happened to be a goto)
was always executed.

Insisting that all statement sequences have {...} braces, even when there is
only one statement, I think would have helped. (Also having statements
require a matching closing delimiter, but C uses {...} braces for
everything.)

As it is, it is common for a statement such as c to not have a } to close
it, so it's easier to miss the bug.

-- 
Bartc
 

[toc] | [prev] | [next] | [standalone]


#41680

From<william@wilbur.25thandClement.com>
Date2014-03-12 12:49 -0700
Message-ID<bbq6va-np7.ln1@wilbur.25thandClement.com>
In reply to#41675
BartC <bc@freeuk.com> wrote:
> 
> 
> "Lynn McGuire" <lmc@winsim.com> wrote in message
> news:lfq0fp$4dp$1@dont-email.me...
>> Is goto Still Considered Harmful?
>>
>> http://www.drdobbs.com/architecture-and-design/is-goto-still-considered-harmful/240166595
> 
> Yes it is frowned upon and it is bad practice. But I'd prefer that a
> language still has it just in case (many don't; C does, otherwise I wouldn't
> be here - I need it for auto-generated code).
> 

The scripting language Lua _added_ goto to it's most recent release, Lua
5.2. Lua is a language that has been in steady development for two decades.

The most significant consideration was making it easier on code generators.

[toc] | [prev] | [next] | [standalone]


#41692

From"Qolin" <noone@nowhere.com>
Date2014-03-12 21:54 +0000
Message-ID<lfql30$e36$1@dont-email.me>
In reply to#41675
"BartC"  wrote in message news:D02Uu.48537$if6.16488@fx07.am4...

>
>
> "Lynn McGuire" <lmc@winsim.com> wrote in message
> news:lfq0fp$4dp$1@dont-email.me...
> > Is goto Still Considered Harmful?
> >
> > http://www.drdobbs.com/architecture-and-design/is-goto-still-considered-harmful/240166595
>
> Yes it is frowned upon and it is bad practice. But I'd prefer that a
> language still has it just in case (many don't; C does, otherwise I 
> wouldn't
> be here - I need it for auto-generated code).
>
> But the code error in the article was about how code blocks are delimited:
>
>  if (a)
>    b;
>    c;
>  if (d) ...
>
> Statements b and c are both indented and look at first glance as though 
> they
> belong to the preceding if-condition, but c (which happened to be a goto)
> was always executed.
>
> Insisting that all statement sequences have {...} braces, even when there 
> is
> only one statement, I think would have helped. (Also having statements
> require a matching closing delimiter, but C uses {...} braces for
> everything.)

On the contrary, IMO the problem is the way C code routinely puts the IF 
statement, and subsequent
executed statement (goto in this case), on separate lines. Had the gotos all 
been on the same lines as the IFs, the
error would have been much more obvious. Like this:

   if ((err = ReadyHash         (&SSLHashSHA1, &hashCtx )) != 0) goto fail;
   if ((err = SSLHashSHA1.update(&hashCtx, &clientRandom)) != 0) goto fail;
   if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0) goto fail;
   if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0) goto fail;
       goto fail;
   if ((err = SSLHashSHA1.final (&hashCtx, &hashOut     )) != 0) goto fail;

(and yes, even in C, _my_ code looks like Fortran).

Qolin at domain dot com
domain is qomputing

[toc] | [prev] | [next] | [standalone]


#41694

FromLynn McGuire <lmc@winsim.com>
Date2014-03-12 16:57 -0500
Message-ID<lfql9q$d92$2@dont-email.me>
In reply to#41692
On 3/12/2014 4:54 PM, Qolin wrote:
> "BartC"  wrote in message news:D02Uu.48537$if6.16488@fx07.am4...
>
>>
>>
>> "Lynn McGuire" <lmc@winsim.com> wrote in message
>> news:lfq0fp$4dp$1@dont-email.me...
>> > Is goto Still Considered Harmful?
>> >
>> > http://www.drdobbs.com/architecture-and-design/is-goto-still-considered-harmful/240166595
>>
>> Yes it is frowned upon and it is bad practice. But I'd prefer that a
>> language still has it just in case (many don't; C does, otherwise I wouldn't
>> be here - I need it for auto-generated code).
>>
>> But the code error in the article was about how code blocks are delimited:
>>
>>  if (a)
>>    b;
>>    c;
>>  if (d) ...
>>
>> Statements b and c are both indented and look at first glance as though they
>> belong to the preceding if-condition, but c (which happened to be a goto)
>> was always executed.
>>
>> Insisting that all statement sequences have {...} braces, even when there is
>> only one statement, I think would have helped. (Also having statements
>> require a matching closing delimiter, but C uses {...} braces for
>> everything.)
>
> On the contrary, IMO the problem is the way C code routinely puts the IF statement, and subsequent
> executed statement (goto in this case), on separate lines. Had the gotos all been on the same lines as the IFs, the
> error would have been much more obvious. Like this:
>
>    if ((err = ReadyHash         (&SSLHashSHA1, &hashCtx )) != 0) goto fail;
>    if ((err = SSLHashSHA1.update(&hashCtx, &clientRandom)) != 0) goto fail;
>    if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0) goto fail;
>    if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0) goto fail;
>        goto fail;
>    if ((err = SSLHashSHA1.final (&hashCtx, &hashOut     )) != 0) goto fail;
>
> (and yes, even in C, _my_ code looks like Fortran).
>
> Qolin at domain dot com
> domain is qomputing

Real programmers can write Fortran in any language.

Lynn

[toc] | [prev] | [next] | [standalone]


#41696

FromKeith Thompson <kst-u@mib.org>
Date2014-03-12 15:36 -0700
Message-ID<lnsiqnqc1g.fsf@nuthaus.mib.org>
In reply to#41692
"Qolin" <noone@nowhere.com> writes:
> "BartC"  wrote in message news:D02Uu.48537$if6.16488@fx07.am4...
>> "Lynn McGuire" <lmc@winsim.com> wrote in message
>> news:lfq0fp$4dp$1@dont-email.me...
>> > Is goto Still Considered Harmful?
>> >
>> > http://www.drdobbs.com/architecture-and-design/is-goto-still-considered-harmful/240166595
>>
>> Yes it is frowned upon and it is bad practice. But I'd prefer that a
>> language still has it just in case (many don't; C does, otherwise I 
>> wouldn't
>> be here - I need it for auto-generated code).
>>
>> But the code error in the article was about how code blocks are delimited:
>>
>>  if (a)
>>    b;
>>    c;
>>  if (d) ...
>>
>> Statements b and c are both indented and look at first glance as though 
>> they
>> belong to the preceding if-condition, but c (which happened to be a goto)
>> was always executed.
>>
>> Insisting that all statement sequences have {...} braces, even when there 
>> is
>> only one statement, I think would have helped. (Also having statements
>> require a matching closing delimiter, but C uses {...} braces for
>> everything.)
>
> On the contrary, IMO the problem is the way C code routinely puts the IF 
> statement, and subsequent
> executed statement (goto in this case), on separate lines. Had the gotos all 
> been on the same lines as the IFs, the
> error would have been much more obvious. Like this:
>
>    if ((err = ReadyHash         (&SSLHashSHA1, &hashCtx )) != 0) goto fail;
>    if ((err = SSLHashSHA1.update(&hashCtx, &clientRandom)) != 0) goto fail;
>    if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0) goto fail;
>    if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0) goto fail;
>        goto fail;
>    if ((err = SSLHashSHA1.final (&hashCtx, &hashOut     )) != 0) goto fail;
>
> (and yes, even in C, _my_ code looks like Fortran).

Very commonly, the code controlled by an if statement consists of
multiple statements that *can't* be written on a single line.
(Syntactically, an if statement always controls exactly one statement;
that can be a compound statement delimited by "{" and "}".)

If the controlled statement happens to be a single very short statement,
I don't mind putting the whole thing on one line, especially if it's one
of several parallel statements:

    if (foo) this;
    if (bar) that;
    if (baz) the_other_thing;

But if it's long enough to need more than one line, I *always* use
braces:

    if (some_condition) {
        this;
        that;
        the_other_thing;
    }

By stubbornly keeping to this habit, I avoid the kind of error we're
discussing.  (It's a habit I picked up from Perl, which requires the
braces even if there's only one statement.)

(Feel free to put the opening "{" on its own line if you prefer.)

(This is cross-posted to comp.lang.fortran and comp.lang.c.  I've
redirected followups to just comp.lang.c; if you want to reply to both,
you'll need to override that.)

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

[toc] | [prev] | [next] | [standalone]


#41698

FromJames Kuyper <jameskuyper@verizon.net>
Date2014-03-12 19:02 -0400
Message-ID<lfqp1c$e91$1@dont-email.me>
In reply to#41696
On 03/12/2014 06:39 PM, Stefan Ram wrote:
> Keith Thompson <kst-u@mib.org> writes:
>> Very commonly, the code controlled by an if statement consists of
>> multiple statements that *can't* be written on a single line.
> 
>   In C, a whole program of many MBytes source code can be written
>   on a single line. The only exceptions are the preprocessor directives.
> 


"Each instance of a backslash character (\) immediately followed by a
new-line character is deleted, splicing physical source lines to form
logical source lines." (5.1.1.2p2)

C implementations are not required to support logical source lines with
more than 4095 characters (5.2.4.1p1). Therefore, you should change
"many MBytes" to "4 KBytes".

Logical source lines are created during translation phase 2, so the only
things affecting the character count are the transformation from file
multi-byte characters to the source character set, and the conversion of
trigraphs to the corresponding single character. By making extensive use
of trigraphs and multi-byte characters, you might be able to stretch
this up to "many KBytes", but you can't get it up to "many MBytes".
-- 
James Kuyper

[toc] | [prev] | [next] | [standalone]


#41704

FromKeith Thompson <kst-u@mib.org>
Date2014-03-12 16:58 -0700
Message-ID<lnk3bzq8ab.fsf@nuthaus.mib.org>
In reply to#41698
James Kuyper <jameskuyper@verizon.net> writes:
> On 03/12/2014 06:39 PM, Stefan Ram wrote:
>> Keith Thompson <kst-u@mib.org> writes:
>>> Very commonly, the code controlled by an if statement consists of
>>> multiple statements that *can't* be written on a single line.
>> 
>>   In C, a whole program of many MBytes source code can be written
>>   on a single line. The only exceptions are the preprocessor directives.
>
> "Each instance of a backslash character (\) immediately followed by a
> new-line character is deleted, splicing physical source lines to form
> logical source lines." (5.1.1.2p2)
>
> C implementations are not required to support logical source lines with
> more than 4095 characters (5.2.4.1p1). Therefore, you should change
> "many MBytes" to "4 KBytes".

No, but they're allowed to do so, and many compilers (I think) impose no
restriction on line length other than available compile-time memory and
other resources.  You can write a "conforming program" (but not a
"strictly conforming program") with, say, a few megabytes on one line.

Not that this is relevant to the original point, of course.

[...]

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

[toc] | [prev] | [next] | [standalone]


#41705

FromJames Kuyper <jameskuyper@verizon.net>
Date2014-03-12 20:09 -0400
Message-ID<lfqsv7$7te$1@dont-email.me>
In reply to#41704
On 03/12/2014 07:58 PM, Keith Thompson wrote:
> James Kuyper <jameskuyper@verizon.net> writes:
>> On 03/12/2014 06:39 PM, Stefan Ram wrote:
...
>>>   In C, a whole program of many MBytes source code can be written
>>>   on a single line. The only exceptions are the preprocessor directives.
>>
>> "Each instance of a backslash character (\) immediately followed by a
>> new-line character is deleted, splicing physical source lines to form
>> logical source lines." (5.1.1.2p2)
>>
>> C implementations are not required to support logical source lines with
>> more than 4095 characters (5.2.4.1p1). Therefore, you should change
>> "many MBytes" to "4 KBytes".
> 
> No, but they're allowed to do so, and many compilers (I think) impose no
> restriction on line length other than available compile-time memory and
> other resources.  You can write a "conforming program" (but not a
> "strictly conforming program") with, say, a few megabytes on one line.
> 
> Not that this is relevant to the original point, of course.

The original point was a style issue that didn't interest me. The line
length was a matter of fact, which did interest me. At least, it
interested me more than the much more boring thing I should have been
doing. :-)
-- 
James Kuyper

[toc] | [prev] | [next] | [standalone]


#41702

FromKeith Thompson <kst-u@mib.org>
Date2014-03-12 16:44 -0700
Message-ID<lnob1bq8w7.fsf@nuthaus.mib.org>
In reply to#41696
ram@zedat.fu-berlin.de (Stefan Ram) writes:
> Keith Thompson <kst-u@mib.org> writes:
>>Very commonly, the code controlled by an if statement consists of
>>multiple statements that *can't* be written on a single line.
>
>   In C, a whole program of many MBytes source code can be written
>   on a single line. The only exceptions are the preprocessor directives.

Amend that to:

... that can't *reasonably* be written on a single line.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

[toc] | [prev] | [next] | [standalone]


#41717

FromRobert Wessel <robertwessel2@yahoo.com>
Date2014-03-12 23:40 -0500
Message-ID<fad2i99mdredal4aha09ebtgs4pbdjbfjh@4ax.com>
In reply to#41692
On Wed, 12 Mar 2014 21:54:42 -0000, "Qolin" <noone@nowhere.com> wrote:

>"BartC"  wrote in message news:D02Uu.48537$if6.16488@fx07.am4...
>
>>
>>
>> "Lynn McGuire" <lmc@winsim.com> wrote in message
>> news:lfq0fp$4dp$1@dont-email.me...
>> > Is goto Still Considered Harmful?
>> >
>> > http://www.drdobbs.com/architecture-and-design/is-goto-still-considered-harmful/240166595
>>
>> Yes it is frowned upon and it is bad practice. But I'd prefer that a
>> language still has it just in case (many don't; C does, otherwise I 
>> wouldn't
>> be here - I need it for auto-generated code).
>>
>> But the code error in the article was about how code blocks are delimited:
>>
>>  if (a)
>>    b;
>>    c;
>>  if (d) ...
>>
>> Statements b and c are both indented and look at first glance as though 
>> they
>> belong to the preceding if-condition, but c (which happened to be a goto)
>> was always executed.
>>
>> Insisting that all statement sequences have {...} braces, even when there 
>> is
>> only one statement, I think would have helped. (Also having statements
>> require a matching closing delimiter, but C uses {...} braces for
>> everything.)
>
>On the contrary, IMO the problem is the way C code routinely puts the IF 
>statement, and subsequent
>executed statement (goto in this case), on separate lines. Had the gotos all 
>been on the same lines as the IFs, the
>error would have been much more obvious. Like this:
>
>   if ((err = ReadyHash         (&SSLHashSHA1, &hashCtx )) != 0) goto fail;
>   if ((err = SSLHashSHA1.update(&hashCtx, &clientRandom)) != 0) goto fail;
>   if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0) goto fail;
>   if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0) goto fail;
>       goto fail;
>   if ((err = SSLHashSHA1.final (&hashCtx, &hashOut     )) != 0) goto fail;
>
>(and yes, even in C, _my_ code looks like Fortran).


What really puzzles me about this bug is that pretty much all C/C++
compilers for large systems (and certainly GCC), will issue an
"unreachable code" warning at all but the minimal warning level.  At
least around here the policy is compile at a high warning level, and
treat warnings as errors, not doing something like that, especially in
security critical code, just seems sloppy.

Now it would be impossible to detect all cases of unreachable code,
but a simple case like this should be trivial.

[toc] | [prev] | [next] | [standalone]


#41733

FromDavid Brown <david.brown@hesbynett.no>
Date2014-03-13 11:25 +0100
Message-ID<lfs130$as9$2@dont-email.me>
In reply to#41717
On 13/03/14 05:40, Robert Wessel wrote:
> On Wed, 12 Mar 2014 21:54:42 -0000, "Qolin" <noone@nowhere.com> wrote:
> 
>> "BartC"  wrote in message news:D02Uu.48537$if6.16488@fx07.am4...
>>
>>>
>>>
>>> "Lynn McGuire" <lmc@winsim.com> wrote in message
>>> news:lfq0fp$4dp$1@dont-email.me...
>>>> Is goto Still Considered Harmful?
>>>>
>>>> http://www.drdobbs.com/architecture-and-design/is-goto-still-considered-harmful/240166595
>>>
>>> Yes it is frowned upon and it is bad practice. But I'd prefer that a
>>> language still has it just in case (many don't; C does, otherwise I 
>>> wouldn't
>>> be here - I need it for auto-generated code).
>>>
>>> But the code error in the article was about how code blocks are delimited:
>>>
>>>  if (a)
>>>    b;
>>>    c;
>>>  if (d) ...
>>>
>>> Statements b and c are both indented and look at first glance as though 
>>> they
>>> belong to the preceding if-condition, but c (which happened to be a goto)
>>> was always executed.
>>>
>>> Insisting that all statement sequences have {...} braces, even when there 
>>> is
>>> only one statement, I think would have helped. (Also having statements
>>> require a matching closing delimiter, but C uses {...} braces for
>>> everything.)
>>
>> On the contrary, IMO the problem is the way C code routinely puts the IF 
>> statement, and subsequent
>> executed statement (goto in this case), on separate lines. Had the gotos all 
>> been on the same lines as the IFs, the
>> error would have been much more obvious. Like this:
>>
>>   if ((err = ReadyHash         (&SSLHashSHA1, &hashCtx )) != 0) goto fail;
>>   if ((err = SSLHashSHA1.update(&hashCtx, &clientRandom)) != 0) goto fail;
>>   if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0) goto fail;
>>   if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0) goto fail;
>>       goto fail;
>>   if ((err = SSLHashSHA1.final (&hashCtx, &hashOut     )) != 0) goto fail;
>>
>> (and yes, even in C, _my_ code looks like Fortran).
> 
> 
> What really puzzles me about this bug is that pretty much all C/C++
> compilers for large systems (and certainly GCC), will issue an
> "unreachable code" warning at all but the minimal warning level.  At
> least around here the policy is compile at a high warning level, and
> treat warnings as errors, not doing something like that, especially in
> security critical code, just seems sloppy.
> 
> Now it would be impossible to detect all cases of unreachable code,
> but a simple case like this should be trivial.
> 

Good point.

One wonders what other errors could be found by a simple "-O2 -Wall",
never mind "-Wextra".


[toc] | [prev] | [next] | [standalone]


#41803

FromThomas Jahns <jahns@idontlikespam.dkrz.de>
Date2014-03-14 11:24 +0100
Message-ID<lfuld4$1uqo$1@gwdu112.gwdg.de>
In reply to#41717
On 03/13/14 05:40, Robert Wessel wrote:
> What really puzzles me about this bug is that pretty much all C/C++
> compilers for large systems (and certainly GCC), will issue an
> "unreachable code" warning at all but the minimal warning level.  At
> least around here the policy is compile at a high warning level, and
> treat warnings as errors, not doing something like that, especially in
> security critical code, just seems sloppy.

http://gcc.gnu.org/ml/gcc-help/2011-05/msg00360.html

so gcc won't warn. Apple uses clang, there the option is not part of -Wall and
therefore easily missed. I'd also advocate using it, because it very often
indicates a block of code improperly compiled (e.g. because of missing #ifdef's).

Thomas

[toc] | [prev] | [next] | [standalone]


#41865

FromRobert Wessel <robertwessel2@yahoo.com>
Date2014-03-14 23:32 -0500
Message-ID<btl7i9p4rkdedu6k72g86gl3qjl3pdcio4@4ax.com>
In reply to#41803
On Fri, 14 Mar 2014 11:24:36 +0100, Thomas Jahns
<jahns@idontlikespam.dkrz.de> wrote:

>On 03/13/14 05:40, Robert Wessel wrote:
>> What really puzzles me about this bug is that pretty much all C/C++
>> compilers for large systems (and certainly GCC), will issue an
>> "unreachable code" warning at all but the minimal warning level.  At
>> least around here the policy is compile at a high warning level, and
>> treat warnings as errors, not doing something like that, especially in
>> security critical code, just seems sloppy.
>
>http://gcc.gnu.org/ml/gcc-help/2011-05/msg00360.html
>
>so gcc won't warn. Apple uses clang, there the option is not part of -Wall and
>therefore easily missed. I'd also advocate using it, because it very often
>indicates a block of code improperly compiled (e.g. because of missing #ifdef's).


Sometimes I just don't understand the motivations of the GCC
maintainers...

[toc] | [prev] | [next] | [standalone]


#41870

FromDr Nick <nospam-4@temporary-address.org.uk>
Date2014-03-15 13:43 +0000
Message-ID<87r463vapv.fsf@temporary-address.org.uk>
In reply to#41803
Thomas Jahns <jahns@idontlikespam.dkrz.de> writes:

> On 03/13/14 05:40, Robert Wessel wrote:
>> What really puzzles me about this bug is that pretty much all C/C++
>> compilers for large systems (and certainly GCC), will issue an
>> "unreachable code" warning at all but the minimal warning level.  At
>> least around here the policy is compile at a high warning level, and
>> treat warnings as errors, not doing something like that, especially in
>> security critical code, just seems sloppy.
>
> http://gcc.gnu.org/ml/gcc-help/2011-05/msg00360.html

That's completely bonkers!  Of course it will give different warnings on
different optimisation settings.  But so what?  No-one is asking it to
warn about /all/ unreachable code (that's solving the halting problem).
But warning about some of it is better than warning about none.  Surely!

> so gcc won't warn. Apple uses clang, there the option is not part of -Wall and
> therefore easily missed. I'd also advocate using it, because it very often
> indicates a block of code improperly compiled (e.g. because of missing #ifdef's).

Well quite.

[toc] | [prev] | [next] | [standalone]


Page 2 of 8 — ← Prev page 1 [2] 3 4 5 6 7 8  Next page →

Back to top | Article view | comp.lang.c


csiph-web