C question

Henry Spencer henry at utzoo.UUCP
Sun Apr 7 10:49:40 AEST 1985


Note that section 7 of K&R Appendix A says explicitly that the order
of side effects within an expression is undefined and is up to the
compiler.  The ANSI C-standard drafts contain similar although more
elaborate wording.  The value of x after:

	x = 5;
	x = x++;

is not 5 or 6, it is "5 or 6".  It is most unwise to write code that
relies on one particular choice.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry



More information about the Comp.lang.c mailing list