This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: string is const char [] ?
- To: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Subject: Re: string is const char [] ?
- From: Kamil Iskra <kamil at dwd dot interkom dot pl>
- Date: Wed, 24 Jun 1998 11:59:50 +0200 (MET DST)
- cc: egcs at cygnus dot com, egcs-bugs at cygnus dot com
On 23 Jun 1998, Alexandre Oliva wrote:
> > char a1[] = "test not const";
> This line should cause egcs to flag an error. The only
> backward-compatibility provided in the standard is [conv.array]/2,
> that allows string literals to be converted to non-const `char*'.
> Hence, string literals cannot be used to initialize a char[]. At
> least a warning should be issued in this case.
Excuse me?! I missed the original mail, but do you really suggest that all
the programmers should suddenly switch to:
char a1[]={'t', 'e', 's', 't', ' ', 'n', 'o', 't', ' ', 'c', 'o', 'n',
's', 't', '\0'};
??? IMO, this is INSANE.
/ Kamil Iskra AmigaOS Linux/i386 Linux/m68k \
| GeekGadgets GCC maintainer UNIX system administrator |
| iskra@student.uci.agh.edu.pl kiskra@ernie.icslab.agh.edu.pl |
\ kamil@dwd.interkom.pl http://student.uci.agh.edu.pl/~iskra /