Old-fashioned assignment operators (was Re: braces

Guy Harris guy at auspex.UUCP
Sun Dec 18 07:28:18 AEST 1988


(Wow, a C question in comp.unix.*, rather than the other way around!)

>  The question I have is, what exactly *is* the correct interpretation of
>x=-y in modern C?

In sufficiently modern C, the interpretation is "assign the negative of
the value of 'y' to 'x'".

>What does the ANSI C standard say about this?

The dpANS says "=-" should not be interpreted as an assignment operator
(and the final standard, once it exists, will almost certainly say the
same thing).  The (non-dpANS-conformant) C compilers AT&T has
distributed with System V releases do not interpret it as such, and
more C compilers are picking this up (for instance, in SunOS 4.0,
support for "old-style assignment operators" went away). 



More information about the Comp.unix.wizards mailing list