i *= f *vs* i = i * f (a partial retraction)
bet at ecsvax.UUCP
bet at ecsvax.UUCP
Sat Apr 21 00:05:25 AEST 1984
Foot in mouth syndrome strikes again...
I seem to have been incorrect in stating that "i *= f" was correctly
handled by simply converting the float to int and multiplying. A number
of people have posted and mailed me notes to the contrary, some citing
Ritchie as agreeing that this is a bug.
The only really applicable item I can find in the BOOK is:
The behavior of an expression of the form E1 op= E2 may be
inferred by taking it as equivalent to E1 = E1 op (E2);
however, E1 is evaluated only once.
I confess to not seeing this as incontrovertably mandating one interpretation
over another; vis-a-vis type conversion, the first clause suggests that
conversion to float for the operation and back is necessary; the second
expresses the basis for my previous stance: that assignment operators
provide a syntax for specifying two-operand instructions, for purposes
of efficiency. I still prefer the latter view; and the only really tangible
evidence I have seen offered that it is wrong is the reference to the opinion
of a demigod. C is ambiguously specified; I think this is just another example.
Lets hear it for semantic specification languages!!!
Unrepentant as ever,
Bennett Todd
...{decvax,ihnp4,akgua}!mcnc!ecsvax!bet
More information about the Comp.lang.c
mailing list