Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2000:
[Freeciv-Dev] C99 vsnprintf().
Home

[Freeciv-Dev] C99 vsnprintf().

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] C99 vsnprintf().
From: gs234@xxxxxxxxx (Gaute (B) Strokkenes)
Date: 02 Sep 2000 01:51:57 +0200

Currently, if the native vsnprintf() does not follow the letter of the
C99 specification, we use a large (64k) buffer and vsprintf() instead.

Requiring strict adherence to C99 is a in my opinion a bit harsh,
since there are a lot of systems around with perfectly good
vsnprintf()'s except for the fact that they do not return the number
of byte written.  Pre-glibc 2.1 systems are one prominent example, and
I'm pretty sure that the Amiga is not up to scratch either.  On the
other hand, there are only 6 places in the source where this behaviour
is actually relied upon.

I have two proposals:
1) Don't rely on C99 behaviour and use strlen() explicitly whenever
   we need this information.
2) Add a call to strlen() in my_vsnprintf() so we don't have to care
   at all.

My preferred method would be no. 1, since this is the most
straight-forward and unobtrusive method.

I think this would be worthwhile, in particular on the Amiga where 64k
is not that insignificant amount.

-- 
Big Gaute (not to be confused with LG)
WHO sees a BEACH BUNNY sobbing on a SHAG RUG?!



[Prev in Thread] Current Thread [Next in Thread]