Also sprach Richard Gooch:
> Hi, all. I've just tried compiling some code on a RedHat 6.0 system,
> and ran across a problem. I've written some test code that
> demonstrates the problem:
>
> % cat egcs-example.c
> #include <ctype.h>
>
> int func (char *array)
> {
> return tolower (array[0]);
> }
> % cc -c -Wall -pedantic-errors -O2 egcs-example.c
> egcs-example.c: In function `func':
> egcs-example.c:5: ANSI C forbids braced-groups within expressions
> % gcc -v
> Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
> gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
It has to do with some interaction between -O2 optimization and tolower(),
it appears. Behold, for the above code:
$ gcc -c -Wall -pedantic-errors mtest.c
$ gcc -c -Wall -pedantic-errors -O2 mtest.c
mtest.c: In function `func':
mtest.c:5: ANSI C forbids braced-groups within expressions
In short, if you drop the -O2 optimization, it compiles. At least it did on
my system.
>
> Anyone familiar with this problem?
>
> Regards,
>
> Richard....
> Old: [EMAIL PROTECTED]
> Current: [EMAIL PROTECTED]
>
--
Running Windows on a Pentium is like having a brand new Porsche but only
be able to drive backwards with the handbrake on.
(Unknown source)