5<a<50 (was:Additions to C - range checking)
Jack Jansen
jack at mcvax.uucp
Mon Jun 30 23:21:51 AEST 1986
In article <155 at daisy.warwick.UUCP> cudcv at daisy.warwick.ac.uk (Rob McMahon) writes:
>In article <523 at ccird1.UUCP> rb at ccird1.UUCP (Rex Ballard) writes:
>>
>>if (5<a<50) do_something(a);
>>
>...
>>
>>Is this impossible to parse?
>
>This was in BCPL, and was a GOOD IDEA.
Yes, it is nice from a users standpoint, but if you want to define
the semantics of this operator in a reasonable way, it becomes
difficult. The only way out I see is to let expressions have *two*
values: an ordinary one, and a success/failure indication. Then you
can let the value of 'a<b' be 'b', and the operator return 'success'
when a is less than b. I remember seeing something about a language that
had such semantics, can't remember which one, however.
--
Jack Jansen, jack at mcvax.UUCP
The shell is my oyster.
More information about the Comp.lang.c
mailing list