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


Groups > comp.lang.c > #162645

Re: I have a confession to make...

From Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups comp.lang.c
Subject Re: I have a confession to make...
Date 2021-09-06 06:30 -0700
Organization A noiseless patient Spider
Message-ID <86lf49vnkj.fsf@linuxsc.com> (permalink)
References <sfc03t$r91$1@dont-email.me> <f5f0f455-3d5a-423b-8624-056999529dc6n@googlegroups.com> <87y291v83n.fsf@bsb.me.uk>

Show all headers | View raw


Ben Bacarisse <ben.usenet@bsb.me.uk> writes:

> [report of early bad experiences with GOTO.]  It put me off for life.
>
> [...]
>
> That said, I've still never had to use one.  I use the fact that I
> want one to prompt me to think if I've got the code wrong and, so
> far, I always decide I have.

I have a different approach.  I learned early on to write code
without considering even the possibility of using goto.  So when
I write code now (and for the last more than 40 years), 'goto'
just isn't in the vocabulary.  Only after having written a full
implementation (of a function or perhaps set of functions), if
the code looks clunky for some reason do I go back (no pun
intended) and explore less orthodox alternatives, including the
possibility of using 'goto'.  It does happen from time to time
that using 'goto' gives a better result along some axes in the
space of possible tradeoffs.  How often?  Rarely.  Somewhere
between once a year and once per decade, if I had to guess.  It's
always a judgment call as to which tradeoffs give the best result
overall.

Incidentally, I put 'switch', and to a lesser extent 'if', in
almost the same category as 'goto'.  Unrestrained use of 'if'
or 'switch' is almost as bad as unrestrained use of 'goto'.

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


Thread

I have a confession to make... Vir Campestris <vir.campestris@invalid.invalid> - 2021-08-15 22:14 +0100
  Re: I have a confession to make... Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-08-15 14:44 -0700
    Re: I have a confession to make... Thiago Adams <thiago.adams@gmail.com> - 2021-08-15 15:56 -0700
      Re: I have a confession to make... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-08-16 01:50 +0100
  Re: I have a confession to make... Bart <bc@freeuk.com> - 2021-08-16 00:18 +0100
  Re: I have a confession to make... DFS <nospam@dfs.com> - 2021-08-15 20:31 -0400
  Re: I have a confession to make... David Brown <david.brown@hesbynett.no> - 2021-08-16 08:20 +0200
    Re: I have a confession to make... "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-08-15 23:21 -0700
    Re: I have a confession to make... Vir Campestris <vir.campestris@invalid.invalid> - 2021-08-17 21:43 +0100
  Re: I have a confession to make... Mark Bluemel <mark.bluemel@gmail.com> - 2021-08-16 00:32 -0700
    Re: I have a confession to make... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-08-16 14:21 +0100
      Re: I have a confession to make... Bart <bc@freeuk.com> - 2021-08-16 17:48 +0100
      Re: I have a confession to make... Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-09-06 06:30 -0700
        Re: I have a confession to make... David Brown <david.brown@hesbynett.no> - 2021-09-06 18:04 +0200

csiph-web