To const or not to const...

Jan-Benedict Glaw jbglaw@lug-owl.de
Thu Feb 20 16:24:00 GMT 2003


On Thu, 2003-02-20 15:27:05 +0100, Christian Ehrhardt <ehrhardt@mathematik.uni-ulm.de>
wrote in message <20030220142705.22460.qmail@thales.mathematik.uni-ulm.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@lug-owl.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/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20030220/bf4d027f/attachment.sig>


More information about the Gcc mailing list