Problem in gcc-2.95

karthik karthik
Wed Sep 15 05:24:00 GMT 1999


Hi,

  I have a declaration

     char asd[5][5] = { "A", "B", "C" };

  My compilation command is

     gcc -fwritable-strings cc2.c


When I compile this with gcc-2.8.1, there are no warnings or errors. The
first element of the first three rows are initialized with 'A', 'B', and
'C' respectively.

However, when I compile this with gcc-2.95 I get the following error(s)

cc2.c:4: initializer element is not constant
cc2.c:4: (near initialization for `asd[0]')
cc2.c:4: initializer element is not constant
cc2.c:4: (near initialization for `asd[1]')
cc2.c:4: initializer element is not constant
cc2.c:4: (near initialization for `asd[2]')

These errors do not occur if I remove the option '-fwritable-strings'.
But the original program in which this error occurred needs this option.

What should I do to use this initialization with -fwritable-strings in
gcc-2.95? Why does it work with gcc-2.8.1 even with -fwritable-strings?
Am I violating any new ANSI C standard?

Please help.

If u want to send info. about any related references please use my
public domain email ID which is

        dkarthikeyan@technologist.com

Thanks in advance.



Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


More information about the Gcc-help mailing list