Is the MapServer code supposed to be ANSI C?

Steve Lime steve.lime at DNR.STATE.MN.US
Tue Feb 1 11:50:51 EST 2005


Hi Petter: Certainly intended to send to the whole list, slip of the
mouse (CC'ing now). After doing a bit of reading after your initial
posting I agree that that ANSI C C89 makes the most logical target at
this point in time.

Steve

>>> Petter Reinholdtsen <pere at hungry.com> 01/31/05 4:23 PM >>>

[Steve Lime]
> Petter: A target has never really been discussed. I think many
> developers took some of their cues (stylewise) from my original
> code, which in some places may be 7 or 8 years old (not too much of
> that left, but there is some). I shot for ANSI C but never
> explicitly set that as a design goal.

Well, unless one agrees on the specification, it is hard to know if
the code is correct or not.  Given a specification, one can decide if
the code or the compiler behaves correctly.  Without a specification,
it is much harder.

And the question about C89 or C99 have practical implications.  Should
code like this be allowed:

  int foo; // C99 comment, illegal in C89.
  char a[foo]; /* varsize array, illegal in C89 */
  char c = -1; /* C89 allow both signed and unsigned char type */
  if (c > 0) /* undefined behavior for C89, well defined for C99 */
     printf("negative c\n");

Because of these and other issues, I would prefer to know if the code
is supposed to be ANSI C or not, and if it is supposed to be ANSI C,
which version of ANSI C it is supposed to be using.

I would prefer the code to follow ANSI C using the C89 specification,
because several of the compilers I am using are not able to handle the
C99 specification yet.

(Btw, why did you send your answer only to me?  I'm happy to discuss
this on the public list. :)



More information about the mapserver-dev mailing list