Re: [boost] Mac OS 10 type_traits/type_with_alignment.hpp
- Original Message - From: Ralf W. Grosse-Kunstleve [EMAIL PROTECTED] To: Boost mailing list [EMAIL PROTECTED] Sent: Saturday, June 07, 2003 5:50 AM Subject: Re: [boost] Mac OS 10 type_traits/type_with_alignment.hpp --- Douglas Gregor [EMAIL PROTECTED] wrote: /var/tmp/mac/boost/boost/type_traits/type_with_alignment.hpp:120: error: no type named `type' in `boost::maybe_print_alignfalse, 8, 4' So you have a type that is 8-byte aligned, but we don't have any types in the list of possible types that have an alignment of 8 on that architecture, so it fails. We'll just have to find a type that has 8-byte alignment and add it to the list. I'll see if I can dig one up tomorrow. Doug ___ Unsubscribe other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Re: [boost] Mac OS 10 type_traits/type_with_alignment.hpp
--- Douglas Gregor [EMAIL PROTECTED] wrote: Hi Doug, If you could figure out what alignment value you're trying to get a type for it would help greatly. One way you could do it would be to replace the static assertion lines with something that will halt the compile and give back the Align value in an error message, e.g., Thanks a lot for your message! // somewhere templatebool DontPrintIt, std::size_t Align struct maybe_print_align { typedef void type; } templatestd::size_t Align struct maybe_print_alignfalse, Align {}; // instead of the static asserts: typedef typename maybe_print_align(found = Align), Align::type foobar; Note that when those static asserts fail, it means that you aren't getting back a type with the right alignment. That's a cool trick and it works great. I've expanded your templates to also print the value of the found constant: templatebool DontPrintIt, std::size_t Align, std::size_t Found struct maybe_print_align { typedef void type; }; templatestd::size_t Align, std::size_t Found struct maybe_print_alignfalse, Align, Found {}; typedef typename maybe_print_align(found = Align), Align, found::type foobar; Here is the error: /var/tmp/mac/boost/boost/type_traits/type_with_alignment.hpp:120: error: no type named `type' in `boost::maybe_print_alignfalse, 8, 4' The full error message is here: http://cci.lbl.gov/~rwgk/tmp/mac_os_10_alignment_problem FYI: In the meantime we've found out that the PowerPC doesn't have strict alignment requirements (but unaligned access may be associated with performance penalties). After a discussion with David Abrahams I've disabled the static assertions in type_with_alignment.hpp: #if !(defined(__APPLE__) defined(__MACH__) defined(__GNUC__)) BOOST_STATIC_ASSERT(found = Align); BOOST_STATIC_ASSERT(found % Align == 0); #endif Ralf __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com ___ Unsubscribe other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Re: [boost] Mac OS 10 type_traits/type_with_alignment.hpp
My apologies for the very late reply. I was away for a while and am still sorting through my inbox... Platform: Mac OS 10.2 gcc 3.3 compiled from sources boost cvs from last Friday When porting the Boost.Python bindings for some custom libraries I ran into a problem with static asserts in type_with_alignment.hpp: [snip patch] This patch allows me to compile and link, and our regression test runs fine. Reducing my code to a minimal test is most likely a time-consuming project that I'd like to avoid if possible (compilation is quite slow to make things worse). Do the authors of the code above have any ideas what could be going wrong? Are there things that I could try first before chopping my code into pieces? If you could figure out what alignment value you're trying to get a type for it would help greatly. One way you could do it would be to replace the static assertion lines with something that will halt the compile and give back the Align value in an error message, e.g., // somewhere templatebool DontPrintIt, std::size_t Align struct maybe_print_align { typedef void type; } templatestd::size_t Align struct maybe_print_alignfalse, Align {}; // instead of the static asserts: typedef typename maybe_print_align(found = Align), Align::type foobar; Note that when those static asserts fail, it means that you aren't getting back a type with the right alignment. Doug ___ Unsubscribe other changes: http://lists.boost.org/mailman/listinfo.cgi/boost