Re: [xml] Re: LibXML2 troubles compiling into MSVC
- From: Igor Zlatkovic <igor stud fh-frankfurt de>
- To: Bjorn Reese <breese mail1 stofanet dk>
- Cc: <xml gnome org>
- Subject: Re: [xml] Re: LibXML2 troubles compiling into MSVC
- Date: Sat, 17 Nov 2001 18:22:10 +0100 (CET)
On Sat, 17 Nov 2001, Bjorn Reese wrote:
IIRC, according to the C++ standard any STL data structure must reside in
the std namespace. An STL list is therefore refered to as std::list, so
there should be no name collisions (unless you use the 'using' operand,
or your C++ vendor forgot to make their compiler C++ compliant :)
Right. Well, I guess that the guy who had the problem used the 'using'
operator, because STL delivered with MSVC does enclose everything in std
namespace. I thought that changing the order in which the headers appear is
easier for him than to remove the 'using' operator and cope with changes in
the source which would become necessary after that. My advice to him was not
meant as a general solution, but just a way to solve his specific problem.
Although this may solve the problem for MSVC, it is not generally
applicable. For example, with the Sun Workshop 5.0 compiler you have
to include STL header before you include any other standard headers
(and libxml includes standard headers). Fortunately, Workshop correctly
uses the std namespace for STL.
STL delivered with MSVC is actually not made by Microsoft, but licensed from
P. J. Plauger's Dinkumware. I didn't notice a behaviour similar to Sun's, I
could normally include STL and standard C headers in any order I wished.
But, I don't use STL in my programs, I just played with it for a while. I
may have missed a point or two.
2. Change the variable names in the libxml headers to be C++ and STL
clean. Although this is a royal PITA, it may be the most portable
solution. [...]
Now we come to the point I wanted to emphasise by posting this topic :-)
If libxml headers use a STL class name, such as 'list' or 'string' or
'vector' as a name for a variable, it can be dealt with. But if someone
oneday uses a C++ keyword, such as 'this', 'new', 'private', 'class' or
similar, we'll have much bigger problems.
Changing libxml headers now to avoid STL names is not an issue. I would not
do that, because STL namespace is a shield enough and the 'using' operator
should be avoided by programmers if it isn't safe to use in their library
constellation. However, I would suggest that the future additions to libxml
headers avoid C++ keywords, because that has a potential to render libxml
unusable in C++, on most platforms.
Ciao
Igor
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]