This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: To const or not to const...


On Thu, 2003-02-20 15:27:05 +0100, Christian Ehrhardt <ehrhardt at mathematik dot uni-ulm dot de>
wrote in message <20030220142705 dot 22460 dot qmail at thales dot mathematik dot uni-ulm dot de>:
> On Thu, Feb 20, 2003 at 03:02:11PM +0100, Jan-Benedict Glaw wrote:
> > int main() {
> > 	int b = "again_hello"[5]; /* #2 */
> > 	return 0;
> > }
> > 
> > 
> > Assignment #2 is okay from GCC's eyes, but #1 isn't:
> 
> This is because in the case of #2 the initializer need not be constant
> because the initialization takes place inside a function.

"Hello"[2] (which is 'l') is truly constant, in my eyes. This could fall
under C99 6.6. OTOH, as also mentioned on #gcc, this may be some
undefined thing wrt. C99 and it may be in conflict with 6.6.9.
However, I'd love to see this implemented:-)

MfG, JBG

-- 
   Jan-Benedict Glaw       jbglaw at lug-owl dot de    . +49-172-7608481
   "Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur
    fuer einen Freien Staat voll Freier Bürger" | im Internet!
   Shell Script APT-Proxy: http://lug-owl.de/~jbglaw/software/ap2/

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]