5<a<50 (was:Additions to C - range checking)
steve at jplgodo.UUCP
steve at jplgodo.UUCP
Fri Jul 11 05:34:38 AEST 1986
In article <7000 at boring.mcvax.UUCP>, jack at mcvax.uucp (Jack Jansen) writes:
>
> 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.
Icon does just such a thing. Expressions have both a success/fail value
and their "normal" value.
--
...smeagol\ Steve Schlaifer
......wlbr->!jplgodo!steve Advance Projects Group, Jet Propulsion Labs
....logico/ 4800 Oak Grove Drive, M/S 156/204
Pasadena, California, 91109
+1 818 354 3171
More information about the Comp.lang.c
mailing list