[xml] The Taint of the Headers



Hi there,

Regarding those macros in function declarations, we decided to post a
probe-file, so everyone can see how it looks like. I have modified a short
one, xmlschemas.h.

In the first part, commented as "Interfaces for parsing", I have put the two
macros at the same line with the return type. In the second part, commented
as "Interfaces for validating", I have put each macro and the return type on
its own line. The arguments remain aligned in both cases.

Now, everyone should take a glance at the attached file. Especially you,
Daniel. :-) See how it looks like tainted with those macros and decide if
you can live with it. If this is okay generally, then also decide which part
do you prefer, the one with macros at the same line with the return type, or
the other, where each element has its own line.

Please take a look at the attached file before reading on. :-)

The macro which declares a function as public I have named XMLPUBFUN. Yes, I
like having fun in a pub, but that isn't the root of this name :-). I can
remember problems somewhere. If a C++ program is compiled which includes
this header, then the compiler wants a keyword 'extern' for variables, but
not for functions (or was it the other way around?). This simply means that
it is better to use separate macros for variables and functions, like this:

  XMLPUBFUN int XMLCALL aFunction(int arg);
  XMLPUBVAR int aVariable;

One additional thought about the macro names: It would be a good idea, if at
all possible, to discuss this on a broader scale. I mean, involve other
project maintainers. It would be great if we could come up with names which
can be accepted and used in more than just libxml2. This would make it a lot
easier to tame the tools which parse the headers. I know that it will last
years until many projects have accepted the same names, if it ever happens.
Still, I think it is worth a try. Without this measure, every project will
have different names, like XMLCALL, XSLTCALL, EXSLTCALL, and what not. The
meaning of these macros is not going to change anymore. Everyone would
benefit if all projects which decide to use them would name them equally. I
certainly don't know how realistic this is, so please comment. Of course, if
you cannot live with the taint in the attached file, then all this is
meaningless anyway.

Ciao,
Igor

Attachment: xmlschemas.h
Description: Binary data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]