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


Groups > comp.lang.c++ > #10275

Re: Thoughts on function

From Miles Bader <miles@gnu.org>
Newsgroups comp.lang.c++
Subject Re: Thoughts on function
Date 2011-09-19 15:19 +0900
Message-ID <87y5xlyrzf.fsf@catnip.gol.com> (permalink)
References (6 earlier) <9dn6ekFr5dU8@mid.individual.net> <d5a55708-e02d-4409-8ee1-7c23573e0a51@c22g2000yqa.googlegroups.com> <857d77ha9jeomb1kbcti9psermtsh4e5j4@4ax.com> <87aaa117ki.fsf@catnip.gol.com> <9dnvmmFr5dU14@mid.individual.net>

Show all headers | View raw


Ian Collins <ian-news@hotmail.com> writes:
>> But let's be fair -- while goto is often[*] used badly, and in such
>> cases makes code harder to understand/maintain, it isn't somehow the
>> kiss of death.  There are reasonable uses of goto.
>>
>> So although the presence of "goto" in code is a big warning sign
>> (especially in C++, where RIAA tends to supplant "goto for error
>> cleanup" idioms), is seems unreasonable to thus grade code a "1"
>> without actually looking at the details of how its used.
>
> Every coding standard I've written or had to follow has prohibited
> goto except in exceptional (and well commented) cases.

That isn't inconsistent with what I said.

It isn't unreasonable for a coding standard, especially those targeted
at non-expert programmers, to outlaw goto with documented exceptions
like that -- the entire point of a coding standard, after all, is to
try and model subjective judgement with something simpler, more
consistent (within the organization), and easier to apply; this is
very valuable when many programmers of varying skill-levels are
working together.

But they aren't an end in themselves, and are not, in the end,
some sort of authoritative statement.

So if the OP was saying "goto gets your code grade 1 _in our
organization, because it violates our coding standards_", that would
be reasonable.  But of course that isn't the scenario here.

[Remember, I'm _not_ defending the OP's use of goto, I'm simply saying
that goto isn't _universally_ bad, and a nuanced discussion of code
quality shouldn't use simplistic shortcuts like that, even if they're
justified in many more practical applications.]

-Miles

-- 
On a bad day, I see brewers still talking as though all beer were
consumed in the pub, by the pint -- by insatiably thirsty Yorkshire
steelworkers who have in reality long ago sought work as striptease
artists.  [Michael Jackson]

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Thoughts on function Ebenezer <woodbrian77@gmail.com> - 2011-09-14 22:01 -0700
  Re: Thoughts on function Ian Collins <ian-news@hotmail.com> - 2011-09-15 17:08 +1200
    Re: Thoughts on function Ebenezer <woodbrian77@gmail.com> - 2011-09-15 07:34 -0700
      Re: Thoughts on function Ian Collins <ian-news@hotmail.com> - 2011-09-16 07:38 +1200
        Re: Thoughts on function Leigh Johnston <leigh@i42.co.uk> - 2011-09-15 20:40 +0100
        Re: Thoughts on function Ebenezer <woodbrian77@gmail.com> - 2011-09-15 17:23 -0700
          Re: Thoughts on function Ebenezer <woodbrian77@gmail.com> - 2011-09-18 13:30 -0700
            Re: Thoughts on function Ian Collins <ian-news@hotmail.com> - 2011-09-19 09:34 +1200
              Re: Thoughts on function Ebenezer <woodbrian77@gmail.com> - 2011-09-18 18:25 -0700
                Re: Thoughts on function Geoff <geoff@invalid.invalid> - 2011-09-18 19:08 -0700
                Re: Thoughts on function Ebenezer <woodbrian77@gmail.com> - 2011-09-18 19:46 -0700
                Re: Thoughts on function Geoff <geoff@invalid.invalid> - 2011-09-18 20:12 -0700
                Re: Thoughts on function Ebenezer <woodbrian77@gmail.com> - 2011-09-18 21:28 -0700
                Re: Thoughts on function Miles Bader <miles@gnu.org> - 2011-09-19 13:26 +0900
                Re: Thoughts on function Ian Collins <ian-news@hotmail.com> - 2011-09-19 16:45 +1200
                Re: Thoughts on function Miles Bader <miles@gnu.org> - 2011-09-19 15:19 +0900
                Re: Thoughts on function Ian Collins <ian-news@hotmail.com> - 2011-09-19 16:43 +1200
                Re: Thoughts on function Ebenezer <woodbrian77@gmail.com> - 2011-09-19 11:16 -0700
                Re: Thoughts on function Ian Collins <ian-news@hotmail.com> - 2011-09-20 07:44 +1200
                Re: Thoughts on function Ebenezer <woodbrian77@gmail.com> - 2011-09-19 18:03 -0700
                Re: Thoughts on function Ian Collins <ian-news@hotmail.com> - 2011-09-20 13:15 +1200
                Re: Thoughts on function Ebenezer <woodbrian77@gmail.com> - 2011-09-19 18:27 -0700
  Re: Thoughts on function Fulvio Esposito <esposito.fulvio@gmail.com> - 2011-09-16 02:19 -0700
    Re: Thoughts on function Ebenezer <woodbrian77@gmail.com> - 2011-09-16 11:20 -0700
      Re: Thoughts on function Fulvio Esposito <esposito.fulvio@gmail.com> - 2011-09-16 13:51 -0700
  Re: Thoughts on function hanukas <jukka@liimatta.org> - 2011-09-19 06:19 -0700

csiph-web