DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23024>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23024 DOMCasts magic: failure building Xerces-C 2.3.0 with C++ Builder 5 Summary: DOMCasts magic: failure building Xerces-C 2.3.0 with C++ Builder 5 Product: Xerces-C++ Version: 2.3.0 Platform: All OS/Version: All Status: NEW Severity: Blocker Priority: Other Component: DOM AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] I'm trying to build the latest Xerces-C2 with C++ Builder 5, starting at the project files provided for 2.2.0 by Hiroyuki Shimada (thanx!) and have run into some problems in the DOM implementation. To be very frank, I'm surprised it works at all, and I'll explain why: the code that troubles me is in the file DOMCasts.hpp. It contains a number of functions that "cast" from one class-type pointer to another, apparently by calculating the offset of a pointer of the other class. For example: static inline DOMNodeImpl *castToNodeImpl(const DOMParentNode *p) { int nodeImplOffset = (char *)&(((DOMElementImpl *)0)->fNode) - (char *)0; int parentOffset = (char *)&(((DOMElementImpl *)0)->fParent) - (char *)0; char *retPtr = (char *)p - parentOffset + nodeImplOffset; return (DOMNodeImpl *)retPtr; } This always returns a pointer exactly 8 bytes before p, regardless of alignment settings on the compiler. On CBuilder 5, with default settings (quadword alignment) the pointer returned corresponds to something, but not what you'd expect, so all DOM tests fail.. If I set the compiler to doubleword alignment, we get a wee bit further in the execution, but access violations aren't rare.. Like I said, I'm frankly very surprised that this works anywhere at all. All this code does is say: "Be afraid - be *very* afraid: I'm going to do a wild-ars guess as to where the pointer you want might point to, and I won't give you a clue as to what sorts of black magic I'll use in the guessing! Who cares about different ABIs for different compilers anyway?" AFAICT, this code only exists to avoid full-fledged pimpls: apparently, whoever wrote this wanted to avoid every DOMParentNode instance to actually have a pointer to its owner (castToNode), every impl class to have a pointer back to the interface instance, and every interface class to have a pointer to its implementation. Now for my question: is there anything I've overlooked, or is the WAGging really intended to avoid actual pimpls? --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]