🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #785

Re: What is a constant expression

#785
From: Wm E Davidsen Jr
Date: Thu, 19 Oct 1989 13:38
31 lines
1884 bytes
In article <1989Oct18.224801.1767@utzoo.uucp>, henry@utzoo.uucp (Henry Spencer) writes:
|  
|  Wonderful index, that... :-(  Try the table of contents:  section 3.4 is
|  all about constant expressions.  Unfortunately, subscripting a string isn't
|  one.

  I blush... I looked in the index and not the TOC. I suspect that I'm
not the only one who thinks the index should be about three times longer
than it is... I feel particularly dumb because I believe I quoted
footnote 44 as part of another posting on sizeof something with a NULL
pointer.

  While the wording in 3.4 is not explicit on this particular case, by
looking at what is allowed and forbidden I conclude that "abcd"[1] is
not treated as a character constant. It would be nice if it was, but it
is treated as if I had said:

	char nameless[] = "abcd";
	char foo = nameless[1];

which clearly isn't allowed for static init.

  I would like to know if the committee considered the indexed string
constant and decided not to make it a special case, or just didn't
think of it when doing this section. Obviously it's not one of the
common uses ;-)
-- 
bill davidsen	(davidsen@crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen)
"The world is filled with fools. They blindly follow their so-called
'reason' in the face of the church and common sense. Any fool can see
that the world is flat!" - anon
Technical Details
Message-ID: <1262@crdos1.crd.ge.COM>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!uwm.edu!cs.utexas.edu!uunet!crdgw1!crdos1!davidsen
References: <1219@crdos1.crd.ge.COM> <1989Oct18.224801.1767@utzoo.uucp>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!uwm.edu!cs.utexas.edu!uunet!crdgw1!crdos1!davidsen
From: davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr)
Newsgroups: comp.std.c
Subject: Re: What is a constant expression
Summary: how embarassing
Message-ID: <1262@crdos1.crd.ge.COM>
Date: 19 Oct 89 13:38:20 GMT
References: <1219@crdos1.crd.ge.COM> <1989Oct18.224801.1767@utzoo.uucp>
Reply-To: davidsen@crdos1.UUCP (bill davidsen)
Organization: GE Corp R&D Center
Lines: 31