ambiguous ?

P E Smee exspes at gdr.bath.ac.uk
Wed Oct 25 19:08:02 AEST 1989


In article <14110 at lanl.gov> jlg at lanl.gov (Jim Giles) writes:
>
>I have still not made my point, but I'm close.  Of course the short
>circuit nature of these operators is valuable.  If they didn't
>short circuit, you would still need a way of providing that functionality.

Valuable indeed.  One of the more common subtle bugs in PL/1 programs is

    if ((ptr ^= null()) & (ptr->thing ^= value))

because PL/1 logical ops don't short circuit.  Algol may have this right,
they offer two sets of logical operators:  AND and OR which do not short
circuit; and ANDTHEN and ORELSE which do.  This gives the programmer total
control, and might be worth considering for some future version of C or
a C offspring.  Both are useful, and making either from the other in a
language which only supports one is fiddly at best.

-- 
 Paul Smee               |    JANET: Smee at uk.ac.bristol
 Computer Centre         |   BITNET: Smee%uk.ac.bristol at ukacrl.bitnet
 University of Bristol   | Internet: Smee%uk.ac.bristol at nsfnet-relay.ac.uk
 (Phone: +44 272 303132) |     UUCP: ...!mcvax!ukc!gdr.bath.ac.uk!exspes



More information about the Comp.lang.c mailing list