[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
ISO C99 features and compatibility
We've recently stopped pretending to support building slapd with a
K&R C compiler; it makes some sense to apply that to the libraries as
well. They are designed to be build-able in more places but it makes
sense to require at least an ANSI C, considering the amount header
cleanup we could do.
I'm also interested in potentially requiring some ISO C99 features;
in particular variadic macros are very very attractive. In addition
to simplifying internal macro design, it allows for a great deal of
cleanup and more flexibile macro use in the rest of OpenLDAP.
Consider Debug() and Statslog(); currently they are mostly the same,
with the idea that Statslog takes two extra dedicated args (for
connid and opid), and that Statslog() should appear even in a non-
LDAP_DEBUG build. As it sits, they don't share code and are
implemented separately. Worse, we have lots of
Debug( LDAP_DEBUG_FOO, "foo\n", 0, 0, 0 );
Where the 0's should not be necessary. Consider the case of adding a
new compile-optional logging type; one currently needs to extend the
macros for Debug() and Statslog() separately, and maintain large and
separate ifdef trees for each build-option permutation. A more
elegant solution involves using a set of common macros to implement
Debug and Statslog internally, but without variadic macros there must
be separate implementations for each argument count, which defeats
the purpose of unifying them in the first place.
Or we could preprocess all of the .c with m4...
But really, it seems reasonable to borrow a few features from a
standard from 1999. Is anyone actively maintaining OpenLDAP on
platforms with no C99ish compiler available?
Matthew Backes
Symas Corporation
mbackes@symas.com