Re: The annotated annotated annotated C standard



In article <eMmdnXnS_8oAaQ_anZ2dnUVZ8t-nnZ2d@xxxxxx>, Richard Heathfield <rjh@xxxxxxxxxxxxxxx> writes
This was the case in out of date languages. It is no longer the case.
In fact, a runtime error produced by a bounds checker is preferable to
"undefined behavior", as is INF or a similar symbol.

Whether this is preferable depends very much on the situation.

Furthermore, nothing in the C Standard forbids it. I've certainly used bounds-checking C compilers.

Doug Gwyn once said that "UNIX was not designed to stop you from doing
stupid things, because that would also stop you from doing clever things."
Very much the same idea applies to C. Yes, some modern languages are
sand-boxes in which you can't break anything no matter how hard you try,
but this is at the expense of limiting your horizons to things which, at
some level, the language designers envisaged when they decided what to
allow and what to disallow.

ISO C doesn't impose such limits. It draws a line around the abstract
machine and says, effectively, "in here, we can make some promises about
program behaviour - but if you step across the line, you're out of the box
and you're on your own".

Exactly. Some of us no longer feel the psychological need to be constrained by the sandboxes. Perhaps Nilges still does.

Or, come to think of it, at college the assembler fans used to refer to those sorts of languages as "Bondage and Discipline languages". Perhaps that says something about him.

[Or perhaps not. But if he can impugn my motives, why can't I impugn his?]

Actually, I've used both "loose control" languages like C and "tight control" languages like Algol. Each has its place.

Basic with the structured programming additions happens to be superior
to C. It evaluates the for limit once and doesn't allow stupid
cleverness.
If what you say about BASIC's for loop is correct (and I am not about to
take your word for it), this makes BASIC's for loop less flexible than
that of C. Full evaluation of the termination condition each time through
the loop is a powerful construct if used properly.

And a dangerous one in others. The correct answer is to realize that both approaches have advantages and disadvantages. Either is a reasonable choice for a language designer to make.

Algol 60 sometimes pre-evaluated and sometimes didn't, depending on the exact notation used. Algol 68 pre-evaluated three of the bounds of a loop but not the fourth.

--
Clive D.W. Feather | Home: <clive@xxxxxxxxxx>
Tel: +44 20 8495 6138 (work) | Web: <http://www.davros.org>
Fax: +44 870 051 9937 | Work: <clive@xxxxxxxxx>
Please reply to the Reply-To address, which is: <clive@xxxxxxxxxx>
.



Relevant Pages

  • Re: Cases where Forth seems a little clunky
    ... complexity of stack shuffling by the complexity of exotic operators. ... with Forth derived languages under RPN. ... that one (I'm lying a bit, I double checked the loop more thoroughly a ...
    (comp.lang.forth)
  • Re: Very poor Lisp performance
    ... Observe LOOP, ... than many Lisp users, as LOOP is offensive to a percentage of Lisp ... >>> natural and programming languages have complicated grammars precisely ... do you agree that languages are evolving to be more concise? ...
    (comp.lang.lisp)
  • Re: Cases where Forth seems a little clunky
    ... complexity of stack shuffling by the complexity of exotic operators. ... with Forth derived languages under RPN. ... that one (I'm lying a bit, I double checked the loop more thoroughly a ...
    (comp.lang.forth)
  • Re: Question about loop
    ... The basic question is can loop be used to write ... Is Common Lisp one of those languages that pretends DELETE is a high ... There has been at least one conforming implementation of Common Lisp ... Sequence may be destroyed and used to construct the result; ...
    (comp.lang.lisp)
  • Re: Looking for a way to convert dec to bin
    ... It's set in stone now for vb but yes, many languages won't work. ... designed languages the loop var is out of scope anyway. ... This loop will probably never exit because b is always 255 or less. ... Generally if I need the index then I won't use foreach. ...
    (microsoft.public.vb.general.discussion)