Ion Gaztanaga wrote:
P.S.: I'm not sure if EDG-based compilers and HP compiler work because I don't have such compilers. If someone wants to help on those, I would be glad.
Below are the results on HP-UX/ia64 in 32- and 64-bit pointer mode using
the program posted by Zeljko Vrba.
The compiler on HP-UX/ia64 is EDG-based so checking both __HP_aCC and
__EDG_VERSION__ in boost/intrusive/detail/parent_from_member.hpp is
reduntant.
bash-2.03$ aCC -V
aCC: HP C/aC++ B3910B A.06.14 [Feb 22 2007]
bash-2.03$ aCC -I./boost -DNN=10 x.cpp && a.out
4 44
bash-2.03$ aCC -I./boost -DNN=20 x.cpp && a.out
4 84
bash-2.03$ aCC -I./boost -DNN=10 +DD64 x.cpp && a.out
8 88
bash-2.03$ aCC -I./boost -DNN=20 +DD64 x.cpp && a.out
8 168
bash-2.03$
x.cpp
-----
#include <iostream>
#include
Hi Zeljko,
Zeljko Vrba wrote:
The following simple program crashes with assertion failure when compiled under Solaris 11 with SunCC: Sun C++ 5.8 Patch 121018-10 2007/02/21
Assertion failed: node_algorithms::unique(to_insert), file boost/boost/intrusive/list.hpp, line 168
I'm using the latest Boost.Intrusive from CVS (snapshot taken 2007-06-03). I have tracked the problem, but I don't know wheter it's the code or compiler problem; see below the code for cause.
Now I must confess it: Boost.Intrusive uses a non-standard and non-portable hack to make member hooks as small as base hooks. This hack uses the fact that for a member stored in a class or in a superclass without any virtual inheritance relationship a pointer to member is just the offset of that member in the class. This offset is encoded differently for different compilers. If you see the file boost/intrusive/detail/parent_from_member.hpp you have the following function:
template
std::size_t offset_from_pointer_to_member(const Member Parent::* ptr_to_member) { //The implementation of a pointer to member is compiler dependent. #if defined(BOOST_MSVC) || defined(__GNUC__) || \ defined(BOOST_INTEL) || defined(__HP_aCC) || \ defined(__EDG_VERSION__) //This works with gcc, msvc, edg, ac++ return *(const std::size_t*)(const void*)&ptr_to_member; #else //This is the traditional C-front approach: CW 9.4, dmc return *(const std::size_t*)(const void*)&ptr_to_member - 1; #endif } This function takes a pointer to member and tries to guess the offset between the class that owns the member and the member. As you can see, for Visual, Intel and GCC a pointer to data member it's just the offset. For compilers like DMC and CW is the offset minus 1.
Since I don't have access to a SunCC compiler you will need to help me discover how SunCC implements pointer to data members. I will need for example the size of a pointer to data member (a simple sizeof(ptr_to_member) would be enough), and what the binary value of of that pointer to member for different layouts, say:
struct klass {
void *data_klass[N];
boost::intrusive::list_member_hook<> hook_;
typedef boost::intrusive::list<
boost::intrusive::list_member_hook<>::value_traits<
klass, &klass::hook_>,
false> list;
};
changing the value of N. Willing to help?
Regards,
Ion
P.S.: I'm not sure if EDG-based compilers and HP compiler work because I don't have such compilers. If someone wants to help on those, I would be glad. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users