On Thu, Oct 23, 2003 at 09:49:34AM -0700, James Berry wrote: > Congratulations on the birth of your daughter. Thanks :)
> The semantics of "here's the alignment that should be applied to a > newly allocated block" versus "here's some details of how you'll be > able to use custom memory management" seem very different to me. I agree, but the fact remains that the following Q/A session will result in a mess: Q: what's the alignment I should use? A: something smaller than the size of a pointer - like zero! Result: part of - or everything of - the pointer can (and will) be overwritten with user data. Thinking of it a bit more, I think a patch should be done to XMLPlatformUtils::alignPointerForNewBlockAllocation that checks whether XML_PLATFORM_NEW_BLOCK_ALIGNMENT < the pointer size, and if so makes it return zero. The caller should check whether 0 was returned and not assume anything about the pointer stored in the data area if it is. Like that, the semantics become well-defined and the question gets a correct answer. I'd agree that this problem is not necessarilly fixed the right way in the patch I sent, but I think we agree there's a problem here. > The fact that XMemory is the one and only user of the alignment function > currently doesn't mean that we should assume it always will be. I agree, but for that case the semantics "how to handle the alignment" should be defined more clearly - e.g. as proposed above. > So _if_ we're to alter XMemory behavior, which we haven't proven is needed > yet, I would definitely want a different way to specify that. As for the need to change: I think badly configuring at compile-time - such as by following indications on this list: the two options given to me (0 and 1 alignment) would break Xerces badly in the current situation - should not result in random (and certainly not in sure) crashes. > I'll grant your statement that XML_PLATFORM_NEW_BLOCK_ALIGNMENT isn't > document except in the header, and simply point out that there's much to > Xerces platform porting that's documented nowhere but in the code. That shouldn't be too much of a problem, as Doxygen is used to create the documentation :) Anyways, most projects (free and otherwise) have a lack of documentation. It's not a reflection of the quality of the code or of the product, but it does make life for the user a bit less easy.. > (1) Understand the problem > (2) Architect a solution > We haven't done (1) yet, and we're arguing about a (2) that has no > purpose I can think of besides making things more complex. I think we have done (1): I think we can both agree that XMLPlatformUtils::alignPointerForNewBlockAllocation (which IMHO is badly named because it doesn't actually align anything) shouldn't return false information and, if it returns 0 (which it should on more occasions) that should actually mean something useful. IMHO, (2) is the next step and I am quite willing to propose patches to fix the problem as soon as we agree on the problem.. rlc --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]