Path: utzoo!attcan!uunet!samsung!sdd.hp.com!ucsd!pacbell.com!ames!dftsrv!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.lang.c Subject: Re: initialization Message-ID: <25841@mimsy.umd.edu> Date: 2 Aug 90 09:45:47 GMT References: <1990Aug1.011654.22068@ccu.umanitoba.ca> <11221@odin.corp.sgi.com> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 21 In article <11221@odin.corp.sgi.com> jindak@surfside.sgi.com (Chris Schoeneman) writes: (re the code `f(int a) { int i = a, j = i + 1;') >... don't worry, the comma operator is evaluated left to right. So your >code will always work correctly (i.e. "a" will be assigned to "i", then >"i"+1 will be assigned to "j"). Strictly speaking, the comma in int i = a, j = i + 1; is not a comma operator. Nonetheless the ANSI C standard guarantees that, after the sequence point at the semicolon, `i' will have the value `a' has and `j' will have the result of `a + 1' (since i==a, i+1 has the same effect as a+1, including such things as runtime traps, at least if overflow is `implementation defined' [I cannot remember whether this is in fact the case]). -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris