C99 structure initialisers and Samba3

tridge at samba.org tridge at samba.org
Wed Aug 23 10:23:50 GMT 2006


Volker,

 > Do you see a chance to write automatic translator from the
 > C99 style init to the old-style one? So that we can #ifdef
 > it for the ancient compilers.

well, we could do this:

#ifdef C99
#define C99INIT (name, value) name = value
#else
#define C99INIT (name, value) value
#endif

but in some ways it makes things worse, as on platforms without a C99
compiler code will break when it doesn't break for all the Samba
developers. Plus we'd still need all the NULL values and the right
ordering.

To do a full translator we'd need to parse the C headers, and
understand the structures. That's more work than I'd be willing to put
into those ancient compilers! They should be relegated to museums
these days anyway :)

I think this is much like the decision we made a few years back when
we decided to drop support for Ultrix cc and SunOS cc as they didn't
support prototypes. There comes a point where anyone building on those
old platforms has either moved to gcc, or has paid for a better
compiler.

We could certainly delay the change by maintaining #ifdef stuff in ldb
in Samba3, but there are 54 of them (totalling a bit over 300 member
initialisations), so it certainly won't look pretty :)

Still, it's nothing like doing the whole of Samba4. If my hackish
egrep is right, there are over 1700 structures initialised this way,
totalling nearly 8000 member initialisers. Trying to maintain those
with both formats would be awful!

Cheers, Tridge


More information about the samba-technical mailing list