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

Grouping and evaluation in expressions

One of the choices made by Dennis Ritchie in the design of C was to give compilers license to rearrange expressions involving adjacent operators that are mathematically commutative and associative, even in the presence of parentheses. This was explicitly noted in the "Reference Manual Appendix" of The C Programming Language, Kernighan and Ritchie,(First Edition). ANSI C does not grant compilers this same freedom.

This section discusses the differences between these two definitions of C and clarifies the distinctions between an expression's side effects, grouping, and evaluation by considering the expression statement from the following code fragment.

   int i, *p, f(void), g(void);
   /*...*/
   i = *++p + f() + g();

Next topic: Definitions
Previous topic: New functions

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005