Re: [xml] libxml2 API crazy?

It is hard to argue with someone that is technically correct.   I am glad they mandated order as I have always programmed that way.  Now I can sleep better, thanks :-)

However, I am old, experienced, etc.  C was not what it is now 30 years ago.  libxml came along and solved a problem.  It is nicely coded, simple to read and understand, and FREE and supported.  I have used so much for so many years (and I have contributed occasionally) that I feel some pride in it.  I think many of us on the list and using the product feel that way and are happy with the product.  And for us old guys "real programmers read code" and "documentation is for those too stupid to figure it out for themselves"  (and that is a joke of sorts even if half true) :-( :-D :-P :-*

If some nice young new person wants to jump in and "fix" things (that for us are not broken) -- I suspect it would be fine.  BUT -- it must remain 100% compatible.  So if you recast things in function calls ... some people may fund their code does not compile any more unless they run around re-casting stuff.  Might piss people off.

Me -- since I use my own abstraction layer, I would care very little.  I could re-do my code in an hour even though I use it literally in hundreds of places.

You might think on that -- see if you can re-cast again in the functions to make them safer.  Or better -- use a sizeof to make sure the padding did not mess with you.

Or just add documentation :-)

Or add a wrapper level so that people can use the old functions as-is and use more modern better casted functions if they chose.

In 5-10 years when I retire and have time I'll help :-)  I've actually always wanted to donate my wrappers as they are very useful and cut the coding to a fraction to use libxml2 ...


On 5/2/2013 8:31 PM, Nikita Churaev wrote:
I bet nobody would complain about documentation!
Normal people who value their time will. XML is the official data format
of planet Earth. Every programming platform must have a decent,
well-documented XML API if it is to survive.

I should point out that in practice the casting is not an issue even
if you are technically correct.  My C textbook says that one cannot
depend on the order of execution for "if" statements.  
I think they've made it standard:

And I understand about the structure padding argument -- in your
example (two ints) they would certainly pad exactly the same in the
real world or the real world would end as we know it.  In fact the
same type should always align the same.  If you mixed double and float
that is another story, they are often different.
Someone on this list said they've made it standard too.

On the other hand -- it never hurts to do it right.  If you wanted to
fix all the "if" statements that would be fine too :-)
The problem is not portability, people said all things that libxml2 uses
are standard, but lack of docs: without reading the libxml2 code, you
can't know what element types XML_ELEMENT_NODE, XML_TEXT_NODE structures
(xmlDoc, xmlNode, xmlAttr) correspond to, etc. There are lots upon lots
of quirks with xmlNodePtr:


Eric S. Eberhard
2933 W Middle Verde Road
Camp Verde, AZ  86322

928-567-3727  work                      928-301-7537  cell             (our work)     (fun pictures)

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