[GRASS-dev] [bug #5002] (grass) lib/gis/color_str.c does not compile

this bug's URL: http://intevation.de/rt/webrt?serial_num=5002
-------------------------------------------------------------------------

Subject: lib/gis/color_str.c does not compile

Platform: Solaris2.x/Sparc
grass obtained from: CVS
grass binary for platform: Compiled from Sources
GRASS Version: cvs checkout 20060814

When compiling with Sun C 5.5 2003/03/12 the following error is reported from file color_str.c in lib/gis/:

"color_str.c", line 54: zero or negative subscript
"color_str.c", line 57: warning: syntax error: empty initializer
"color_str.c", line 112: warning: statement not reached
cc: acomp failed for color_str.c

A workaround is to change row 46:
#define NUM_COLORS 1

and to uncomment line 56 to have one value in the table:
{"purple", 128, 0, 255}

It seems that a static construct without explicit initialization is not legal, at least in this compilers opinion.

Harri K.

-------------------------------------------- Managed by Request Tracker

Request Tracker wrote:

this bug's URL: http://intevation.de/rt/webrt?serial_num=5002
-------------------------------------------------------------------------

Subject: lib/gis/color_str.c does not compile

Platform: Solaris2.x/Sparc
grass obtained from: CVS
grass binary for platform: Compiled from Sources
GRASS Version: cvs checkout 20060814

When compiling with Sun C 5.5 2003/03/12 the following error is reported from file color_str.c in lib/gis/:

"color_str.c", line 54: zero or negative subscript
"color_str.c", line 57: warning: syntax error: empty initializer
"color_str.c", line 112: warning: statement not reached
cc: acomp failed for color_str.c

A workaround is to change row 46:
#define NUM_COLORS 1

and to uncomment line 56 to have one value in the table:
{"purple", 128, 0, 255}

It seems that a static construct without explicit initialization is not legal, at least in this compilers opinion.

Zero-size arrays aren't legal C; they're a gcc extension.

It appears that the code in question was left in as "documentation" of
the previous behaviour.

Fixed in CVS.

--
Glynn Clements <glynn@gclements.plus.com>