Article View: comp.std.c
Article #4248Re: Comma operator in constant expression
From: Jens M Andreasen
Date: Thu, 19 Oct 1995 13:58
Date: Thu, 19 Oct 1995 13:58
22 lines
1336 bytes
1336 bytes
On Thu, 19 Oct 1995, Kevin D. Quitt wrote: > Paul Long <plong@perf.com> wrote: > > static int i = 1 ? 3 : (1, 2); > Do you get get same result if you change the left-hand 1 to a 0? If not, > it may be that the second half of the expression is never even examined. That would not change anything. Even if 0 was the first argument to ?, the expression will collapse into a single assignment (i = 2) since the expression in front of the comma is also (almost) empty. The compiler will read it in and immidiately forget it was ever there . He will have to put a little more "action" into the expression to wake up the compiler :). To me this looks like a perfectly legal empty statement. The alternative would be a compiler with the speed of a lawyer. all IMHO of course // Jens M Andreasen
Technical Details
Message-ID:
<Pine.ULT.3.91.951019140628.10600A-100000@mars.dsv.su.se>Path:
arc1-ca.pugleaf.net!mars.dsv.su.se!jens-andReferences:
<45uevf$d99@news0.rain.rg.net> <1995Oct19.005829.12311@llyene.jpl.nasa.gov>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!mars.dsv.su.se!jens-and From: Jens M Andreasen <jens-and@dsv.su.se> Newsgroups: comp.std.c Subject: Re: Comma operator in constant expression Date: Thu, 19 Oct 1995 14:58:37 +0100 Message-ID: <Pine.ULT.3.91.951019140628.10600A-100000@mars.dsv.su.se> References: <45uevf$d99@news0.rain.rg.net> <1995Oct19.005829.12311@llyene.jpl.nasa.gov> NNTP-Posting-Host: mars.dsv.su.se Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII In-Reply-To: <1995Oct19.005829.12311@llyene.jpl.nasa.gov>