This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: warn/croak on "string" "string" auto-joins
- From: "Dave Korn" <dk at artimi dot com>
- To: "'Gabor Greif'" <gabor at mac dot com>,"'Adam Monsen'" <haircut at gmail dot com>
- Cc: <gcc at gcc dot gnu dot org>
- Date: Wed, 18 Aug 2004 10:44:09 +0100
- Subject: RE: warn/croak on "string" "string" auto-joins
> -----Original Message-----
> From: gcc-owner On Behalf Of Gabor Greif
> Sent: 18 August 2004 01:45
> >> This would have helped early and is good practice:
> >>
> >> char *months[12] = {"Jan", "Feb", "Mar", "Apr", "May",
> "Jun", "Jul",
> >> "Aug" "Sep", "Oct", "Nov", "Dec"};
> >>
> >> --> high probability warning
> >
> > I'm not sure I understand, what does "high probability
> warning" mean?
> > I get no errors/warnings from the following:
> >
> > #include <stdio.h>
> > int main( void )
> > {
> > char *months[15] = {"Jan", "Feb", "Mar", "Apr", "May",
> "Jun", "Jul",
> > "Aug" "Sep", "Oct", "Nov", "Dec"};
> > printf("7: %s\n", months[8]);
> > return 0;
> > }
> >
> > compiled with 'gcc -Wall -pedantic -ansi', using GCC 3.3.3.
>
> Hmm, I could have sworn that a mismatch in array dimensions
> does emit a warning (too many initializers do error out "como").
> Looks like this is not the case. Sorry for bothering you :-(
But it has too *few* initialisers!
cheers,
DaveK
--
Can't think of a witty .sigline today....