Re: cdb++ on a 64-bit machine?

Jeff King <[email protected]> Sat, 12 Apr 2003 12:43:01 -0400 (EDT)
Newsgroups gmane.comp.djb.cdb
Message-ID <[email protected]>
On Sat, 12 Apr 2003, Matthias Andree wrote:

> Well you aren't getting anywhere with your Unix software when
> constraining yourself to C89 or C99. You will also need to look at the
> "extensions" such as POSIX :-)

That's a fair assessment. It seems like DJB has often stuck to the
"require as few standards as possible" mindset in his software. Note the
partial reimplementation of libc he uses in most of his software. I
expect this is partially to provide better function interfaces (from a
security perspective). But I think in some cases he's trying to avoid
inconsistencies in adherence to and implementation of standards.

Perhaps the man himself will weigh in on this discussion. :)

> stdint.h a relatively new header. IEEE 1003.1-2001 in fact talks of
> stdint.h as a SUBSET of inttypes.h, being "more suitable for use in
> free-standing environments".

Bear in mind that cdb predates this standard, and that not all platforms
have been updated and upgraded to reflect it. The real question to
answer is not so much "which standard gives me uint32_t" but rather, "is
a uniform 32-bit unsigned int type available on all platforms I wish to
support?" If one of your platforms is an old version of HP-UX, you might
be out of luck. :)

> Practically, I've tried to go with stdint.h for bogofilter, but I found
> too few systems supported it, so I just include inttypes.h where it's
> present and try some compile-time tests to figure a uint32_t if
> inttypes.h is not present. Haven't yet received uint32_t portability
> complaints.

This is sort of what I mean above. Matching standards is one thing, but
oftentimes the "most portable" thing can only be determined through
practice. This is why resources like
<URL:http://cr.yp.to/docs/unixport.html> are valuable.


Anyway, I don't so much mean to disagree with you as to provide another
perspective. Standards-wise, it seems like you've done more homework
than I on stdint. :)

We should probably wrap this thread up soon, though, since it's barely
related to cdb at this point.

-Peff