Is the MapServer code supposed to be ANSI C?

Frank Warmerdam fwarmerdam at GMAIL.COM
Sat Feb 5 23:59:22 EST 2005


On Sat, 5 Feb 2005 11:00:55 +0100, Petter Reinholdtsen <pere at hungry.com> wrote:
> Am I correct when I believe the code also assume 'char' is a signed
> type?  This is undefined in C89, so the code need to be changed to use
> 'signed char' or 'int8_t' (from <inttypes.h>) to make sure the code
> work on all C89-compatible compilers.  The type is signed on i386
> archs, and several others as well, and this is the reason I suspect
> the code assume 'char' to always be signed.  The code I recently found
> with this problem was the 'char classindex' member of
> resultCacheMemberObj, which is compared to zero.  This test do not
> make sense with some compilers, and the best way to fix this is to
> change the type to 'signed char classindex' or 'int8_t classindex' in
> map.h.  I suspect this problem exist elsewhere too, but I haven't been
> able to locate other problems yet.

Petter,

My thinking is that we should not be using signed chars for class
indexes anyways.  We don't want to restrict ourselves to 128 classes.
Perhaps the code in question should just be using short or int for class
index.

I notice that in  other places (such as labelCacheMemberObj) the
classindex is an int. That is certainly what I have used in the raster
code.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the mapserver-dev mailing list