🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4255

Re: Comma operator in constant expression

#4255
From: Jens M Andreasen
Date: Fri, 20 Oct 1995 08:07
31 lines
2099 bytes

On 19 Oct 1995, Peter Seebach wrote:

> In article <Pine.ULT.3.91.951019204530.7241B-100000@mars.dsv.su.se>,
> Jens M Andreasen  <jens-and@dsv.su.se> wrote:
> Re: >static int i = 1 ? 3 : ( 1, 2);
> 
> >I interprete that as a way of saying that you are allowed to obfuscate 
> >your constants any way you like, as long as they remain constants. There is 
> >nothing in the expression above that could ever be nothing but a constant.
> 
> Except that the standard *EXPLICITLY* says that a "constant expression"
> *CANNOT* contain a , operator.  Period.

Period what? I did an example parsing showing that the comma will 
disappear , vanish, go out of existence, DIE, or whatever parafrase ...

Now suppose we were to scan this expression again, hmmm. What would we go 
for? There could be a dangerous illegal statement hidden somewhere, hmmm.
We can't go for the questionmark ('?' would have been legal), nor can we 
go for the comma (',' is also legal). 

Also, static int i =   "  1 ? 3 : ( 1, 2)  ";   is of course illegal but 
for a completely different reason. Now to get to the point; How many 
*wrong* strings are we gonna test before we know that the expression is not 
against the rules of the game (near infinity AFAIK). Remember that the 
original expression collapsed into one single constant!!! (or prove me 
otherwise and I shall shut up immediately).

 // Jens M Andreasen                  (Yes, I represent meself only)
Technical Details
Message-ID: <Pine.ULT.3.91.951020083514.12953B-100000@mars.dsv.su.se>
Path: arc1-ca.pugleaf.net!mars.dsv.su.se!jens-and
References: <45uevf$d99@news0.rain.rg.net> <Pine.ULT.3.91.951017124752.2343A-100000@mars.dsv.su.se> <464s1t$lb4@usenet.pa.dec.com> <Pine.ULT.3.91.951019204530.7241B-100000@mars.dsv.su.se> <466v8b$2em@solutions.solon.com>

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: Fri, 20 Oct 1995 09:07:37 +0100
Message-ID: <Pine.ULT.3.91.951020083514.12953B-100000@mars.dsv.su.se>
References: <45uevf$d99@news0.rain.rg.net> <Pine.ULT.3.91.951017124752.2343A-100000@mars.dsv.su.se> <464s1t$lb4@usenet.pa.dec.com> <Pine.ULT.3.91.951019204530.7241B-100000@mars.dsv.su.se> <466v8b$2em@solutions.solon.com>
NNTP-Posting-Host: mars.dsv.su.se
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
In-Reply-To: <466v8b$2em@solutions.solon.com>