Paul Gilmartin wrote:

<begin snippet>
Likewise, the arithmetic IF or use of a single-argument signum with
two comparands requires a subtraction which may result in overflow for
extreme comparand values.
</end snippet>

I am not quite sure what a 'single-argument signum' with two
comparands is.  For such common FORTRAN as

|           float*4 x
|  .  .  .
|           if (x)  12, 14, 16
|  .  .  .
|     12  <code for negative x>
|  .  .  .
|     14  <code for zero x>
| .  .  .
|     16  <code for positive x>

There is of course a subtraction in the compiled code, but in my
experience it is an innocuous one: zero is subtracted from x to set a
condition code or the like.  (When x is replaced by a non-degenerate
expression overflow may of course be a problem, as it is in all
arithmetic.)

There are of course things that can be done to minimize such problems
Kernighan and Ritchie did not do it in their example.  They wrote

|       mid = (low+high) / 2;

but

|       mid = low + (high - low)/2 ;

all but eliminates subscript-arithmetic overflow problems when, as in
C, obligatory zero-origin subscripting is used.  It is also possible
to go much further down this path, but I will forebear.

Here and elsewhere he and others of his persuasion advance one
standard argument when they are confronted with examples of  lacunæ,
infelicities and inefficiencies in minimalist languages like Pascal
and C:  An optimizing compiler will automagically eliminate them.

There are two objections to this argument.

The first is the factual one that optimizing compilers often omit to
do what one would wish them to do.

The second, which I think more weighty,. is the odorous notion that
programmers should be protected from knowledge of what von Neumann
machines really do because some of the things they do are notionally
error-prone.  With a prefixed warning of an ad hominem argument to
come, I have always suspected that academics---With a few conspicuous
exceptions they are poor programmers---would like to avoid teaching
programming at all.  Then---wish being father to thought---they
imagine that a programming language that makes the teaching of
programming all but unnecessary  has been made available to them.

In fact of course Pascal, C and the like lend themselves to misuse as
readily as do other, more expressive languages.   The notion that
languages should enforce someone's notions of good programming
practices is at once utopian, authoritarian, and morally dubious.  It
puts me in mind of Orwell's description of Newspeak in the appendix to
1984.

<begin snippet>
The purpose of Newspeak was not only to provide a medium of expression
for the world-view and mental habits proper to the devotees of Ingsoc,
but to make all other modes of thought impossible.  It was intended
that when Newspeak had been adopted once and for all and Oldspeak
forgotten, a heretical thought---that is a thought diverging from the
principles of Ingsoc---should be literally unthinkable, at least so
far as thought is dependent upon words.  Its vocabulary was so
constructed as to give exact and often very subtle expression to every
meaning that a Party member could properly wish to express, while
excluding all other meanings and also the possibility of arriving at
them by indirect means.  This was done partly by inventing new words
but chiefly by eliminating undesirable words . . . Quite apart from
the suppression of definitely heretical words, reduction of vocabulary
was regarded as an end in itself, and no word that could be dispensed
with was allowed to survive.  Newspeak was designed not to extend but
to diminish the range of thought, and this purpose was indirectly
assisted by cutting the choice of words down to a minimum.
</end snippet>

John Gilmore, Ashland, MA 01721 - USA

Reply via email to