string is const char [] ?

Alexandre Oliva oliva@dcc.unicamp.br
Wed Jun 24 03:36:00 GMT 1998


Kamil Iskra <kamil@dwd.interkom.pl> writes:

> On 23 Jun 1998, Alexandre Oliva wrote:
>> >   char a1[] = "test not const";

>> This line should cause egcs to flag an error.

> 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'};

How about:

const char a1[] = "test not const";

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil




More information about the Gcc-bugs mailing list