On Sun, 31 Dec 2006 14:14:26 -0500, "marko" <marko@validnow.com>
wrote:
Quote:
>I was reading page 131 in K&R C 2nd ed. book.
>
>In page 63,
>
>"The commas that seperate function arguments, variables in declarations, etc
>are not comma operators, and do not guarantee left to right evaluation."
>
>and bottom of page 131 there's example of
struct rect r, *rp = &r;
>also in page 216, near bottom,
int i, *pi, *const cpi = &i;
>
>my question is if comma in declaration does not gurantee left to right
>evaluation, how did in examples latter valuables declared and intialized to
>value of previous valuables on same line?
>
>couln't the *rp declared before r is declared?
>
Even though the comma is not a comma operator, section 6.2.1-4 states
that the scope of an identifier is determined by the placement of its
declaration. 6.2.1-7 states that the scope begins just after the
completion of its declarator. The comma marks the end of the
declaration of r and the start of rp. r is therefore in scope at the
time rp is declared and the compiler is not allowed reverse the order.
Remove del for email