[
https://issues.apache.org/jira/browse/XALANC-733?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13464948#comment-13464948
]
Steven J. Hathaway commented on XALANC-733:
-------------------------------------------
I have found something that appears to work -- here is the C++ issue
related to static integer member initializations within a class.
Here is my set of Three tests.
[1]-- START OF FILE --
class Test
{
public:
static const XalanDOMChar * some_method (XalanNode * theNode,
const XalanDOMChar * AltString = &s_empty)
{ return AltString; }
private:
static const XalanDOMChar s_empty = 0;
};
-- END OF FILE --
The initialization and linking works OK for GNU G++ Version 4.4.
The initialization and linking works OK for Microsoft .NET 2003 and newer.
The initialization and linking fail for GNU G++ 4.2 and (BSD)
The initialization and linking fail for AIX.
[2]-- START OF FILE =
class Test
{
public:
static const XalanDOMChar * some_method (XalanNode * theNode,
const XalanDOMChar * AltString = &s_empty)
{ return AltString; }
private:
static const XalanDOMChar s_empty = 0;
};
static const XalanDOMChar s_empty;
-- END OF FILE --
This has a problem for each .cpp source file that includes the
above .hpp header file. Each instance of s_empty outside of
class becomes a duplicate initialization issue for which linkers
have problem.
[3]-- START OF FILE --
class Test
{
public:
static const XalanDOMChar * some_method (XalanNode * theNode,
const XalanDOMChar * AltString = getEmpty())
{ return AltString; }
private:
static const XalanDOMChar * getEmpty()
{
static const XalanDOMChar theZero = 0;
static const XalanDOMChar * theEmpty = &theZero;
return (theEmpty)
}
};
-- END OF FILE --
The initialization and linking works OK for all the above systems.
I will construct a new patch to handle the issue in light of these
findings.
- Steve
> Ensure that XalanLocator::getSystemId() and getPublicId() do not return NULL
> ----------------------------------------------------------------------------
>
> Key: XALANC-733
> URL: https://issues.apache.org/jira/browse/XALANC-733
> Project: XalanC
> Issue Type: Bug
> Components: XalanC, XPathC
> Affects Versions: 1.11
> Reporter: Steven J. Hathaway
> Assignee: Steven J. Hathaway
> Attachments: XalanLocator-3.patch, XalanLocator.patch,
> XalanLocator.patch2
>
>
> The recommended patch to "xalanc/PlatformSupport/XalanLocator.hpp"
> ensures that getSystemId() and getPublicId() do not return NULL pointers.
> XalanC source files that can benefit from the patch include:
> xalanc/PlatformSupport/ProblemListenerBase.cpp
> xalanc/PlatformSupport/XSLException.cpp
> xalanc/XPath/XPathExecutionContextDefault.cpp
> The patch will be submitted shortly.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]