At 10:11 12.06.00 +0100, John P. Looney (Kate) wrote:
>On Fri, Jun 09, 2000 at 03:45:31PM +0200, Caolan McNamara mentioned:
> > I was always sceptical of qmail and its claims, but looking through
> > his source and his website at http://cr.yp.to I think i might have to eat
> > my own words. Supraparanoid programming, gotta love it.
>>I noticed he doesn't #include *any* system
>headers in most code, and got more scared when I noticed that his
>ideas of Makefiles differ from any other person...
Yeah that'd be because he has given up on just about all the standard
c libraries etc, he doesn't trust them one bit. There is an element of
truth in that where a spec is not nailed down implementers will do
contradictory things, there are little rabbit holes here and there as
to how functions will behave. Take the admittedly nonstandard snprintf,
Return Values:
a) (old glibc and others) The number of characters actually written
to the buffer unless it was truncated in which case it returns -1
b) (new glibc, c9x proposal and FreeBSD methinks) The number of
characters which *would* have been written if all went well and -1
for some sort of inconceivable failure, the correct interpretation.
c) (also seen) return of the desired len INCLUDING the \0.
Special Arguments:
int i = snprintf(NULL,0,"%s","apple");
a) C9x proposal
i is 5
b) solaris et al
i is -1, i.e. an argument of len 0 is not allowed
I put together a autoconf test for all this nonsense at
http://sourceware.cygnus.com/ml/autoconf/2000-05/msg00030.html
and a patch at http://www.csn.ul.ie/~caolan/publink/snprintf/
to upgrade http://www.ijs.si/software/snprintf/ to the desired
behaviour so that you can do something about it if the snprintf
on your system is useless.
Given this sort of stuff its no wonder frustration levels might
send you to reimplement some reliable functions with known side
effects. Personally though I sort of prefer working around them
with autoconf et al.
C.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!