About your example, it would also be my expectation that a C implementation of

int bar = (7 > 3) ;

would set bar equal to +1, since 7 is indeed greater than 3.

My favorite language is assembly language, but it is true that I among
statement-level languages I strongly prefer Pl/I to C.  C is, in my
view, a flawed toy programming language that now suffers grievously
from hypertrophy.   (It is also correct, as you conjectured, that the
low and high bounds of a PL/I array were classically limited only by
the inequality -2^31 <= L <= H <= +2^31 - 1, -2147483648 <= L <= H <=
+2147483647.)

That said, and given the absence of a logical data type in C, the
convention of returning -1 as a surrogate for the outcome false is
appropriate if ugly.

It is, however, appropriate to distinguish between an outcome and a
return code in many, indeed most contexts, i.e., to avoid confounding
the true|false dichotomy with the success|fsailure dichotomy.  If a C
function conducts a search for, say, an element of a character array
that has the valuew '?' and does not find one, returning -1 to
indicate this is in C appropriate.  If instead a C function attempts
to open a file and does not succeed in doing so, returning -1 as an
indicator that it failed  is not in my view enough.  In this case I
would wish to have some further diagnostic information.

Opinions about such issues do differ; these differences are often as
much visceral as intellectual; and it is my guess that we shall never
agree about this and much else.

John Gilmore, Ashland, MA 01721 - USA

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to