Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: "LJEB" <LJEB@somewhere.out.there>
Subject: Re: Drop C/C++ better sooner than later
Date: Thu, 1 Mar 2001 11:54:07 -0000	[thread overview]
Message-ID: <97ld8a$e1e$1@soap.pipex.net> (raw)
In-Reply-To: 97j900$ppc@dispatch.concentric.net


"Rick Cadruvi" <rick@rdperf.com> wrote in message
news:97j900$ppc@dispatch.concentric.net...
> > >         2. SWITCH/CASE doesn't auto-break.  I NEVER depend on being
able
> > >            to fall through to the next CASE in a SWITCH statement.
The
> > >            default should be BREAK and allow specifying CONTINUE if
you
> > >            want to drop through.  THIS IS A BIG PROBLEM!!!
> >
> > I would have to say NO!
> >
> > I use this feature from time to time, and when needed it can very
useful,
> > and saves unnecessary tests and duplicated code. Apart from that I think
> > that I cannot remember when a missing "break" caused me any problems the
> > last time, it was so long ago.
> >
> > Also "continue" has a completely defined and simple function.
> >
> BREAK could be defined to only deal with loops too, but it is used in
> SWITCH/CASE.  There is no reason CONTINUE couldn't be used
> as well.  My point is only that the NORMAL use is to BREAK after
> a case rather than dropping down.  The default should always be the
> normal usage, not the exception in my view.
>

I understand what you are getting at here, and to some degree, I agree.
For instance when I use this fall through I nearly always have a comment
with:
    /* DON'T BREAK HERE */
So the next programmer knows for certain that I want to carry on, and that
it was not an omission.

It is likely that my use of C has something to do with my outlook, a lot of
work that I do is handling and decoding data feeds (e.g.: processing data
received from stock exchanges). Just like the washing machine example posted
here, there are often places where you need to select a start point, and
then continue until the end or an exception it found.

Also I use the following a lot:

    switch( value )
    {
    case    value_a:
    case    value_b:
    case    value_c:
    case    value_d:
        /* common code for this set of values */
        break;

    case    value_e:
    case    value_f:
        /* common code for this set of values */
        break;

    default:
        break;
    }

For me having to remember to add all the appropriate CONTINUE statements is
just as bad as you see the opposite view.

> > >
> > >         3. BREAK.  Break should be allowed from ALL Begin/End ({})
> > >            constructs (including IF ELSE).  You should also be able to
> > >            BREAK # where # is the number of Begin/End blocks you want
> > >            to break out of.
> >
> > Sorry but this is about the most horrible suggestion for any language I
> have
> > ever seen.
>
> The thing a language should do is provide the tools to make the code as
> simple
> as possible.  Many times you get inside of something and you really want
to
> get
> out of multiple levels.  If the point is that the BREAK # has to be a
> constant
> number rather than a variable, I agree entirely.  However, setting and
> testing
> flags to exit levels makes for more code and makes bugs more likely.  The
> real problem is not when you are writing the code, but when someone else
> comes along to maintain the code and misses the flags.  Here's an example:
>
>     for (i = 0, i < 10; i++)
>       {
        if( other_condition )
        {    /* see trailing comment */
    >       if (condition[i] == TRUE)
    >          {
    >          for (j = 0; j < 5; j++)
    >             {
    >              if  (stuff[j] == FALSE) break 3    // Get me out
    >             }
    >          }
        }    /* it become too easy to break with a simple additions */
>     }
>
> I know the example is simplistic, but if expanded into more involved
> code, the value of the contruct becomes more clear.  The truth is that
> I would probably have made the inner loop a function call and the problem
> goes away.  What I am saying is that occasionally, I would like to be
> able to leave more than a single BEGIN/END.  Also, I would like to
> be able to leave an IF or ELSE BEGIN/END early sometimes to simplify
> the code.

As you said, normally you put this inner loop into a function. The fact that
you cannot do the break# thing, in my view actually forces the programmer to
write code that is easier to maintain.

As many of the faults you and other see with this language are that they let
programmers write code that is difficult to maintain, this  addition would
just give your novice another way to write horrible code.

Adding something that you might occasionally us, would not stop it from
being abused to a point that it would soon be regarded as something that
should never have been there.

Personally I think that GOTO should just be removed from the language (or at
least make compilers complain about it use). I have not even wanted to use
all the time I have written in C/C++, and the only times I have seen it used
was because a routine was just too big (ie: should have been broken down
into proper functional units).

Laurence.




  reply	other threads:[~2001-03-01 11:54 UTC|newest]

Thread overview: 168+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <OF5876F951.ACBD5F93-ON032569FC.003E241B@ep-bc.petrobras.com.br>
     [not found] ` <87n1baae6s.fsf@prep.synonet.com>
2001-02-25 17:38   ` So what Are we meant to use on the 'desktop' Terry C. Shannon
2001-02-25 19:23     ` David Mathog
2001-02-26  1:18       ` Christof Brass
2001-02-26  1:59         ` Bill Todd
2001-02-26 12:49           ` Larry Kilgallen
2001-02-26 19:09             ` Rick Cadruvi
2001-02-26 20:47               ` Larry Kilgallen
2001-02-26 21:04               ` Bill Gunshannon
2001-02-27  0:07                 ` Christof Brass
2001-02-27  1:00                   ` Bill Todd
2001-02-27  1:26                     ` Drop C/C++ better sooner than later Christof Brass
2001-02-27  2:47                       ` Rick Cadruvi
2001-02-27  3:59                         ` JF Mezei
     [not found]                       ` <XyEm6.896$be1.355692@paloalto-snr1.gtei.neDistribution: world <wrCvgGxaSLv9@eisner.encompasserve.org>
2001-02-27 21:13                         ` Rick Cadruvi
2001-02-27 22:34                           ` Christof Brass
2001-02-28  1:36                             ` Rick Cadruvi
2001-02-28 13:48                               ` LJEB
2001-02-28 16:28                                 ` Rick Cadruvi
2001-03-01 11:54                                   ` LJEB [this message]
2001-02-28 14:22                               ` Bill Gunshannon
2001-02-28 14:33                                 ` John Reagan
2001-02-28 15:19                                   ` Jan Vorbrueggen
2001-02-28 16:42                                   ` Rick Cadruvi
2001-02-28 17:45                                     ` John Reagan
2001-02-28 14:58                                 ` Robert Deininger
2001-02-28 15:29                                   ` Jan Vorbrueggen
2001-02-28 16:55                                   ` Bill Gunshannon
2001-02-28 18:05                                     ` Bob Koehler
2001-03-01  9:07                                       ` Jan Vorbrueggen
2001-02-28 18:34                                     ` Larry Kilgallen
2001-02-28 23:10                                       ` Rick Cadruvi
2001-02-28 19:52                                     ` Robert Deininger
2001-03-01 14:21                                     ` Bob Koehler
     [not found]                                     ` <KForX+5U$4bOrganization: Encompasserve <ZDsZwRGKoAEm@eisner.encompasserve.org>
2001-03-01 15:16                                       ` Jan Vorbrueggen
2001-03-01 21:58                                         ` JF Mezei
2001-03-02 10:26                                           ` Alan Greig
2001-03-05 10:20                                             ` Jan Vorbrueggen
2001-02-28 20:19                                   ` JF Mezei
2001-03-01 13:52                                     ` Bill Gunshannon
2001-03-01 15:13                                       ` Jan Vorbrueggen
2001-03-01 16:05                                         ` Bill Gunshannon
2001-03-01 17:08                                         ` Robert Deininger
2001-03-01 17:47                                           ` Rick Cadruvi
2001-03-01 20:36                                             ` Paul Repacholi
2001-03-01 23:11                                             ` Christof Brass
2001-03-03 14:54                                             ` Jan Vorbrueggen
2001-03-06 19:24                                               ` Bill Gunshannon
2001-03-06 21:53                                                 ` Larry Kilgallen
2001-03-06 22:29                                                   ` David J. Dachtera
2001-03-07  0:33                                                   ` Brian Schenkenberger, VAXman-
2001-03-07  2:53                                                     ` Christof Brass
2001-03-07  3:27                                                       ` Robert Deininger
2001-03-07 14:33                                                       ` Bill Gunshannon
2001-03-07 14:21                                                 ` Jan Vorbrueggen
2001-03-13  7:49                                                 ` Fred Zwarts
2001-03-13 16:12                                                   ` John Reagan
2001-03-01 16:58                                       ` Robert Deininger
2001-03-01 21:45                                       ` JF Mezei
2001-03-01  3:40                                   ` Christof Brass
2001-03-01  5:52                                     ` Robert Deininger
2001-03-01  3:33                                 ` Christof Brass
2001-03-01  6:03                                   ` JF Mezei
2001-03-01 17:11                                     ` Rick Cadruvi
2001-03-01 23:28                                       ` Christof Brass
2001-03-01 23:47                                         ` Rick Cadruvi
2001-03-02 10:45                                           ` Paul Repacholi
2001-03-02 18:52                                             ` Rick Cadruvi
2001-03-03  1:42                                               ` Christof Brass
2001-03-02  1:11                                         ` Brian Schenkenberger, VAXman-
2001-03-02  5:06                                           ` Rick Cadruvi
2001-03-02 10:32                                           ` Brian Schenkenberger, VAXman-
2001-03-06 20:47                                             ` bob.marcan
2001-02-28 15:03                               ` Per Schr�der
2001-02-28 16:50                                 ` Rick Cadruvi
2001-02-28 17:48                               ` Bob Koehler
2001-02-28 18:26                                 ` Bill Gunshannon
2001-03-01 13:41                                 ` Bob Koehler
2001-02-28 18:22                               ` Larry Kilgallen
2001-03-01  1:39                               ` Christof Brass
2001-03-01  9:38                                 ` Jan Vorbrueggen
2001-03-01 17:20                                   ` Rick Cadruvi
2001-03-01 23:38                                     ` Christof Brass
2001-02-28 12:39                           ` Bill Gunshannon
2001-02-27 23:00                       ` Larry Kilgallen
2001-02-28  0:12                       ` Brian Schenkenberger, VAXman-
2001-02-28 13:56                         ` Bill Gunshannon
2001-02-28 15:11                           ` Jan Vorbrueggen
2001-02-28 16:31                           ` Rick Cadruvi
2001-02-28  2:14                       ` Larry Kilgallen
2001-02-28  2:46                       ` Bill Todd
2001-03-01  2:12                         ` Christof Brass
     [not found]                       ` <XyEm6.896$be1.355692@paloalto-snr1.gtei.neDistribution: world <009F8479.B6EC89DC@SendSpamHere.ORG>
2001-03-01  1:46                         ` Christof Brass
     [not found]                       ` <XyEm6.896$be1.355692@paloalto-snr1.gtei.neDistribution: world <5ABc4wgf5wcs@eisner.encompasserve.org>
2001-02-28  4:46                         ` Rick Cadruvi
2001-02-28  6:28                           ` Robert Deininger
2001-02-28  7:16                             ` JF Mezei
2001-02-28 16:05                               ` Rick Cadruvi
2001-03-01  2:46                               ` Christof Brass
2001-03-01  2:25                             ` Christof Brass
2001-02-28  7:08                           ` JF Mezei
2001-02-28  8:52                             ` Jan Vorbrueggen
2001-03-01  2:47                             ` Christof Brass
2001-03-01  6:37                               ` Nikita V. Belenki
2001-03-01 23:40                                 ` Christof Brass
2001-03-03 10:18                                   ` Nikita V. Belenki
2001-03-03 10:40                                     ` Christof Brass
2001-03-12  3:29                                       ` Mark Garrett
2001-03-12  4:05                                         ` Bob Willard
2001-03-12  8:02                                         ` Paul Repacholi
2001-03-15 14:13                                           ` Alan Greig
2001-02-28 13:39                           ` Bob Koehler
2001-02-28 16:11                             ` Rick Cadruvi
2001-02-28 20:00                             ` JF Mezei
2001-03-01  9:16                               ` Jan Vorbrueggen
2001-03-01 23:42                                 ` Christof Brass
2001-03-01 13:48                               ` Bill Gunshannon
2001-03-01 23:18                                 ` John Santos
2001-02-28 18:11                           ` Larry Kilgallen
2001-02-28 20:01                             ` Robert Deininger
2001-03-01  2:18                           ` Christof Brass
     [not found]                           ` <9hjmlkwyghte@eisner.encompasserve.org>
2001-02-28 17:59                             ` Bob Koehler
2001-02-28 18:31                               ` Bill Gunshannon
2001-03-01 15:40                               ` Bob Koehler
     [not found]                               ` <97Organization: Encompasserve <Y$aqbQdRtYFw@eisner.encompasserve.org>
2001-03-01 17:38                                 ` Rick Cadruvi
2001-03-01 18:53                                 ` Nikita V. Belenki
2001-03-01 18:10                               ` Larry Kilgallen
2001-03-02 13:13                               ` Bob Koehler
2001-03-02 13:24                               ` Bob Koehler
2001-02-28 23:08                             ` Larry Kilgallen
2001-03-01 13:50                             ` Bob Koehler
2001-03-01 13:54                             ` Bob Koehler
2001-03-01 15:12                               ` Jan Vorbrueggen
2001-02-28  8:46                         ` Jan Vorbrueggen
2001-03-01  1:56                         ` Christof Brass
2001-02-26 12:17       ` So what Are we meant to use on the 'desktop' Alan Greig
2001-02-25 19:51     ` VMS wanted list. Was: " Paul Repacholi
2001-02-25 20:45       ` VMS wanted list Terry C. Shannon
2001-02-25 22:44         ` Howard S Shubs
2001-02-26  0:37           ` Terry C. Shannon
2001-02-26  1:19             ` Eric Smith
2001-02-26  4:13             ` Howard S Shubs
2001-02-26  5:27               ` Terry C. Shannon
2001-02-26  6:38                 ` Howard S Shubs
2001-02-27  0:12                   ` Christof Brass
2001-02-27  3:22                     ` Terry C. Shannon
2001-02-27 22:37                       ` Christof Brass
2001-02-27 11:15                   ` Brian Schenkenberger, VAXman-
2001-02-27 22:37                     ` Christof Brass
2001-02-28  2:12                   ` Bob Kaplow
     [not found]                   ` <3A9AF0DB.Organization: What, me, organized? <rUslzcAE$7$5@eisner.encompasserve.org>
2001-03-12  2:49                     ` Mark Garrett
2001-03-12 13:52                   ` Bob Kaplow
2001-02-26 15:35                 ` Tim Llewellyn
2001-02-26 23:51                   ` Terry C. Shannon
2001-02-27  0:15                   ` Christof Brass
2001-02-26 11:27               ` Brian Schenkenberger, VAXman-
2001-02-27 21:43                 ` Terry C Shannon
2001-02-27 22:07                 ` Brian Schenkenberger, VAXman-
2001-02-26 19:16             ` Rick Cadruvi
2001-02-26  0:48           ` Christof Brass
2001-02-26 12:43         ` Larry Kilgallen
2001-02-26 13:02           ` Terry C. Shannon
2001-02-26 15:48           ` Jan Vorbrueggen
2001-02-26 16:47       ` VMS wanted list. Was: So what Are we meant to use on the 'desktop' Hoff Hoffman
2001-02-26 21:01         ` Bill Gunshannon
2001-02-27  0:19         ` Christof Brass
     [not found]           ` <97giah$jo3@gap.cco.caltech.edu>
2001-02-27 21:19             ` Rick Cadruvi
2001-02-27 22:44               ` Christof Brass
2001-02-28 16:37         ` VMS wanted list. Take II Paul Repacholi
2001-03-01  4:17           ` Christof Brass
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox