[variant]bug: max used instead of lcm

The make_storage template at line 215 of: http://boost.cvs.sourceforge.net/boost/boost/boost/variant/variant.hpp?revision=1.97&view=markup uses max over the alignment_of's for the types in the variant (See line2 233-235) to calculate the variant's alignment. However, to handle the extended alignments described on page 3 of: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2165.pdf the boost::math::static_lcm template should be used instead of max.

Larry, Larry Evans wrote:
The make_storage template at line 215 of:
http://boost.cvs.sourceforge.net/boost/boost/boost/variant/variant.hpp?revision=1.97&view=markup
uses max over the alignment_of's for the types in the variant (See line2 233-235) to calculate the variant's alignment. However, to handle the extended alignments described on page 3 of:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2165.pdf
the boost::math::static_lcm template should be used instead of max.
Excellent catch. I've created http://svn.boost.org/trac/boost/ticket/993 for this issue. The question I have now is the urgency of the fix. In particular, this issue has been in the code since the beginning but has not been reported, suggesting perhaps it has not caused problems in practice. Do you have any thoughts? Thanks, Eric

On 05/24/2007 01:52 PM, Eric Friedman wrote:
The question I have now is the urgency of the fix. In particular, this issue has been in the code since the beginning but has not been reported, suggesting perhaps it has not caused problems in practice. Do you have any thoughts?
AFAICT, it's not at all urgent. As implied elsewhere in this newsgroup, ( http://archives.free.net.ph/message/20051028.195214.9f0154e1.en.html ) there's probably very few compiler/platforms that produce non-power-of-2 alignments. Just thought I'd make sure though. It certainly would help if the rationale for using max (e.g. input conditions: all alignments are power of 2) were put in as comments in the code. Actually, I'm trying to understand alignments myself and I just wanted to make sure max was used because the code expected all alignments were power of 2.
participants (2)
-
Eric Friedman
-
Larry Evans