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

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004