Subject: Re: main return...
To: None <jfw@funhouse.com>
From: Not for internal consumption <greywolf@defender.VAS.viewlogic.com>
List: current-users
Date: 03/27/1996 10:22:03
John Woods sez:
- Ty Sarna says of "void main()":
- > Shoot, look at all the quite experienced C programmers who don't know
- > it's not allowed!
-
- Look at all the "quite experienced" C programmers who don't know that
-
- a[i] = i++;
-
- is not allowed.
-
You're kidding, right? I was sure it wasn't _recommended_, but I
didn't know it was explicitly forbidden.
According to the rules of ordinal evaluation:
[] binds first, left to right, so we have a[i].
++ binds next, right to left, so i is now i+1.
= binds last, right to left, so a[i] has the value i+1.
Of course, when compiled, the ++ gets eval'd *AFTER* the assignment
(StunOS 4.x standard compiler AND gcc do this -- is this right?).
[Followups to that last question to be redirected to greywolf@starwolf.com,
let's not start YAS semantics war.]
-
- And weep for the state of education.
I don't know a compiler that would reject the code. Of course, that
speaks loudly for the state of education among compiler writers, I
suppose...
-
-