🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #41636

Re: Is this a compiler bu

#41636
From: Martin Ambuhl
Date: Thu, 29 Feb 1996 00:00
52 lines
1632 bytes
"Edward J. Huff" <huffe@carbon.chem.nyu.edu>
in <3135FEDB.65AA@carbon.chem.nyu.edu> asks:

>Is this a bug?  Or is it "support for traditional practice"?

Neither, for my copy of gcc.  It is erroneous.

>==> static_bug.c <==
>static const char foo[];

>int
>main(int argc, const char *argv[]) {
>  printf("foo = '%s'\n",foo);
>  return 0;
>}

>#ifdef DEFINE_IT
>static const char foo[] = "bar";
>#endif

>==> static_bug2.c <==
>const char foo[] = "baz";
>carbon% gcc static*.c

My copy of gcc reports (with my usual -Wall -ansi -pedantic):
1: array size missing in `foo'
 In function `main':
5: warning: implicit declaration of function `printf'

>carbon% a.out
>foo = 'baz'

...and certainly does not produce an executable.

>carbon% gcc -DDEFINE_IT static*.c

My copy of gcc reports (with my usual -Wall -ansi -pedantic):
1: array size missing in `foo'
 In function `main':
5: warning: implicit declaration of function `printf'
 At top level:
10: warning: initializer-string for array of chars is too long

>carbon% a.out
>foo = 'bar'

...and certainly does not produce an executable.

                                                                 
--
* Martin Ambuhl       net: mambuhl@ripco.com
* Chicago, IL (USA)    
Technical Details
Message-ID: <4h591v$8np@gail.ripco.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,41999a1d074e7bb3,start
X-Google-Attributes: gid11318c,public
From: mambuhl@ripco.com (Martin Ambuhl)
Subject: Re: Is this a compiler bu
Date: 1996/02/29
Message-ID: <4h591v$8np@gail.ripco.com>
X-Deja-AN: 141635624
organization: Ripco Communications, Inc.
newsgroups: gnu.gcc.help