Yet another pcc botch

Norman Diamond diamond at csl.sony.JUNET
Thu Jan 26 15:46:52 AEST 1989


In article <398 at lakart.UUCP>, dg at lakart.UUCP (David Goodenough) writes:
>
> lvc at cbnews.ATT.COM (Lawrence V. Cipriani) sez:
> ] f = -150.000000, g = 65386.000000
> ] The correct value for g is -150.000000.
> 
> No. The correct value for g is 65386.0 [1]. If you read the gospel
> according to Kernighan and Ritchie [2],
> 
> [2] :-)

Is this first-edition :-) or second-edition :-) ?

The subtraction operator was applied to a short and an unsigned short,
and the result (either unsigned short or signed int) converted to float.
Under the old unsigned-preserving rules, both f and g should have been
65366.0.  Under the ANSI value-preserving rules, both f and g should be
-150.0.

Mr. Cipriani assumed that System V Releases 2 and 3 should support
modern semantics.  The gurus that he asked, and Mr. Goodenough, perhaps
in the interests of backwards compatibility, feel that they should
support Version 7 semantics.  The System V Release 2 version, in the
interests of pleasing everybody, took the middle road.  Conclusion:
that wasn't a bug, that was a feature.
-- 
Norman Diamond, Sony Computer Science Lab (diamond%csl.sony.jp at relay.cs.net)
  The above opinions are my own.   |  Why are programmers criticized for
  If they're also your opinions,   |  re-inventing the wheel, when car
  you're infringing my copyright.  |  manufacturers are praised for it?



More information about the Comp.lang.c mailing list