🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4234

Comma operator in constant expression

#4234
From: Paul Long
Date: Mon, 16 Oct 1995 20:23
20 lines
1538 bytes
Is an implementation required to generate a diagnostic for this declaration?

   static int i = 1 ? 3 : (1, 2);

A constraint in section 6.4 says "Constant expressions shall not contain ...
comma operators..." However, a 6.4 Semantics passage says "An implementation
may accept other forms of constant expressions."

This rather large Semantics loophole does not remove the requirement to
generate a diagnostic for the constraint violation though, right? IOW, an
implementation may "accept" a comma operator in a constant expression, but it
must also generate a diagnostic. Neither Sun's acc compiler or Gnu's 2.6.0
compiler generate a diagnostic for this declaration. Does that mean that they
are NOT conforming implementations? If they are, please explain.

-- 
Paul Long                               45:29:14N 122:48:09W
plong@perf.com                          http://www.teleport.com/~pciwww/
    "Where time or intelligence are lacking, a goto may do the job."
        - M.E. Hopkins, "A Case for the GOTO," 1972.
Technical Details
Message-ID: <45uevf$d99@news0.rain.rg.net>
Path: arc1-ca.pugleaf.net!usenet.eel.ufl.edu!pacifier!rainrgnews0!usenet

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!usenet.eel.ufl.edu!pacifier!rainrgnews0!usenet
From: Paul Long <plong@perf.com>
Newsgroups: comp.std.c
Subject: Comma operator in constant expression
Date: 16 Oct 1995 20:23:11 GMT
Organization: Performance Computing Incorporated
Message-ID: <45uevf$d99@news0.rain.rg.net>
NNTP-Posting-Host: yosemite.perf.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 1.1N (X11; I; SunOS 4.1.1 sun4c)
X-URL: news:comp.std.c