Messages in this thread | | | Date | Wed, 31 Mar 1999 20:06:56 -0500 | From | Arvind Sankar <> | Subject | Re: [OFFTOPIC] Re: A bit off-topic ... (fwd) |
| |
On Thu, Apr 01, 1999 at 08:42:01AM +0800, David Luyer wrote: > Try this one - > > main() { > int x=0, y=0, z = 0; > > x ? y : z = 1; > > printf("%d %d %d\n", x, y, z); > } > > Compiles fine. Output: 0 0 1. > Now set x=1 and find output: 1 1 0. > Isn't that sick :-) gcc 2.7.2.3.
what's sick about it? it's a documented gcc extension.
> > Based on that, a really good compiler could give your above statement as > > x = (x=1) = 2
this is illegal. First, (x=1) is not an lvalue, secondly even if it were, the assignment would be undefined.
> > and then come out with x = 2.
or mke2fs /dev/{h,s}da just to teach you a lesson :)
-- arvind
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |