🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4252

Re: Comma operator in constant expression

#4252
From: Peter Seebach
Date: Fri, 20 Oct 1995 01:50
22 lines
1500 bytes
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.

This is like a "C compiler" that does not diagnose the syntax error in:
	// foo
... it doesn't matter how *sensible* it may seem, The Standard makes it
quite clearly a syntax error *requiring* a diagnostic.

-s
-- 
Peter Seebach - seebs@solon.com || seebs@intran.xerox.com --
C/Unix proto-wizard -- C/Unix questions? Send mail for help.  No, really!
Copyright 1995 Peter Seebach.  --  High energy particle theology
The *other* C FAQ - ftp taniemarie.solon.com /pub/c/afq
Technical Details
Message-ID: <466v8b$2em@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
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>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: seebs@solutions.solon.com (Peter Seebach)
Newsgroups: comp.std.c
Subject: Re: Comma operator in constant expression
Date: 19 Oct 1995 20:50:03 -0500
Organization: Usenet Fact Police (Undercover)
Message-ID: <466v8b$2em@solutions.solon.com>
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>
NNTP-Posting-Host: solutions.solon.com