DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Complying with standard C

The ``as if'' rule

There were good reasons for the Kernighan and Ritchie C rearrangement rules:

The ANSI C committee eventually became convinced that the rearrangement rules were intended to be an instance of the ``as if'' rule when applied to the described target architectures. ANSI C's ``as if'' rule is a general license that permits an implementation to deviate arbitrarily from the abstract machine description as long as the deviations do not change the behavior of a valid C program.

Thus all the binary bitwise operators (other than shifting) are allowed to be rearranged on any machine because there is simply no way to notice such regroupings. On typical two's complement machines in which overflow silently wraps around, integer expressions involving multiplication or addition can be rearranged for the same reason.

Therefore, this change in C does not have a significant impact on most C programmers.


Next topic: Incomplete types
Previous topic: Parentheses grouping and evaluation

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003