Re: [boost] Re: Patch for function/function_base.hpp
Dave Gomboc wrote: > > > Ah, that's the reason. But given my recent discomfort about > > unmaintainable code, look at it again: > > > > # if BOOST_WORKAROUND(__HP_aCC, <= 33900) > > template struct enable_if; > > # else > > template struct enable_if; > > # endif > > > > Does this really makes sense? Shouldn't we just keep one version with > > names for template parameters? AFAICS this should work for all compilers > > and it could be a general boost coding guideline to always provide names > > for template parameters. Comments? > > Nah, the vendors will never fix problems that we hide. In some regular > code I might just switch it, but since some vendors _are_ using Boost to > test their compiler conformance, we should leave the HP workaround in (and > use the same or a new workaround for VisualAge also). That way, when they > compile with BOOST_NO_CONFIG they will see the problem. It's a reasonable approach. Another one might be a macro called BOOST_UNUSED_TEMPLATE_PARAMETER which will be used like BOOST_STATIC_CONSTANT and resolves to nothing for conforming compilers and leaves a dummy name in for broken compilers. Usage: template< BOOST_UNUSED_TEMPLATE_PARAMETER( bool, cond ), BOOST_UNUSED_TEMPLATE_PARAMETER( typename, T ) > struct enable_if; Note that I do not prefer this style, I just want to mention another option. I think it's still better than #ifdef's but I won't bother too much if there is one coding guideline which could solve all issues. Boost is already too complicated to add political/educational stuff for compiler vendors instead of adding just the technically needed stuff for compilers. We could continue by adding BOOST_FOR to replace all for-loops in case a compiler has broken scope for declared variables. For conforming compilers: #define BOOST_FOR for and for broken compilers: #define BOOST_FOR if(false);else for there are so many ways to obfuscate the code... hehe... Regards, Daniel -- Daniel Frey aixigo AG - financial training, research and technology Schloß-Rahe-Straße 15, 52072 Aachen, Germany fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99 eMail: [EMAIL PROTECTED], web: http://www.aixigo.de ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Re: [boost] Re: Patch for function/function_base.hpp
On Thursday 13 February 2003 04:38 am, Daniel Frey wrote: > Ah, that's the reason. But given my recent discomfort about > unmaintainable code, look at it again: > > # if BOOST_WORKAROUND(__HP_aCC, <= 33900) > template struct enable_if; > # else > template struct enable_if; > # endif > > Does this really makes sense? Shouldn't we just keep one version with > names for template parameters? AFAICS this should work for all compilers > and it could be a general boost coding guideline to always provide names > for template parameters. Comments? FWIW, I didn't apply the patch directly but instead changed it to what you ask: template struct enable_if; I'd be fine with making this a coding guideline... Doug ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Re: [boost] Re: Patch for function/function_base.hpp
> Ah, that's the reason. But given my recent discomfort about > unmaintainable code, look at it again: > > # if BOOST_WORKAROUND(__HP_aCC, <= 33900) > template struct enable_if; > # else > template struct enable_if; > # endif > > Does this really makes sense? Shouldn't we just keep one version with > names for template parameters? AFAICS this should work for all compilers > and it could be a general boost coding guideline to always provide names > for template parameters. Comments? Nah, the vendors will never fix problems that we hide. In some regular code I might just switch it, but since some vendors _are_ using Boost to test their compiler conformance, we should leave the HP workaround in (and use the same or a new workaround for VisualAge also). That way, when they compile with BOOST_NO_CONFIG they will see the problem. Dave ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Re: [boost] Re: Patch for function/function_base.hpp
Markus Schöpflin wrote: > > Daniel Frey wrote: > > > Markus Schöpflin wrote: > > >>This was the original source: > >> > >>template struct enable_if; > >>---^ > >> > >>Visual Age doesn't like this, it needs a name here. > > > > ^^ > > > > Ah, that's the reason. But given my recent discomfort about > > unmaintainable code, look at it again: > > > > # if BOOST_WORKAROUND(__HP_aCC, <= 33900) > > template struct enable_if; > > # else > > template struct enable_if; > > # endif > > > > Does this really makes sense? Shouldn't we just keep one version with > > names for template parameters? AFAICS this should work for all compilers > > and it could be a general boost coding guideline to always provide names > > for template parameters. Comments? > > Agreed, if it works for all compilers, let's just keep the version > with the names. (And add a comment that it should stay like it is!) No, don't add a comment. Let's make it a boost coding guideline, otherwise we will clutter the code again with comments instead of workarounds. Remember that this is only one example of a line with template parameters. Would you like to add a comment for every line all over boost? Regards, Daniel -- Daniel Frey aixigo AG - financial training, research and technology Schloß-Rahe-Straße 15, 52072 Aachen, Germany fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99 eMail: [EMAIL PROTECTED], web: http://www.aixigo.de ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
[boost] Re: Patch for function/function_base.hpp
Daniel Frey wrote: Markus Schöpflin wrote: When posting the patch, I didn't even realize that the code was legal and that this is a problem with VACPP6. And the aCC workaround fixes the problem for VA, too. This was the original source: template struct enable_if; ---^ Visual Age doesn't like this, it needs a name here. ^^ Ah, that's the reason. But given my recent discomfort about unmaintainable code, look at it again: # if BOOST_WORKAROUND(__HP_aCC, <= 33900) template struct enable_if; # else template struct enable_if; # endif Does this really makes sense? Shouldn't we just keep one version with names for template parameters? AFAICS this should work for all compilers and it could be a general boost coding guideline to always provide names for template parameters. Comments? Agreed, if it works for all compilers, let's just keep the version with the names. (And add a comment that it should stay like it is!) Markus ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Re: [boost] Re: Patch for function/function_base.hpp
Markus Schöpflin wrote: > > Daniel Frey wrote: > > > On Wed, 12 Feb 2003 18:37:51 +0100, Markus Schöpflin wrote: > > > >> Attached is a small patch for function_base.hpp. On line 302, > >> there is a T missing. > > > > Just a stupid question: Why is it "missing"? What is this patch > > supposed to fix? > > This was the original source: > > template struct enable_if; > ---^ > > Visual Age doesn't like this, it needs a name here. ^^ Ah, that's the reason. But given my recent discomfort about unmaintainable code, look at it again: # if BOOST_WORKAROUND(__HP_aCC, <= 33900) template struct enable_if; # else template struct enable_if; # endif Does this really makes sense? Shouldn't we just keep one version with names for template parameters? AFAICS this should work for all compilers and it could be a general boost coding guideline to always provide names for template parameters. Comments? Regards, Daniel -- Daniel Frey aixigo AG - financial training, research and technology Schloß-Rahe-Straße 15, 52072 Aachen, Germany fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99 eMail: [EMAIL PROTECTED], web: http://www.aixigo.de ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
[boost] Re: Patch for function/function_base.hpp
Daniel Frey wrote: On Wed, 12 Feb 2003 18:37:51 +0100, Markus Schöpflin wrote: Attached is a small patch for function_base.hpp. On line 302, there is a T missing. Just a stupid question: Why is it "missing"? What is this patch supposed to fix? This was the original source: template struct enable_if; ---^ Visual Age doesn't like this, it needs a name here. Marus ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
[boost] Re: Patch for function/function_base.hpp
On Wed, 12 Feb 2003 18:37:51 +0100, Markus Schöpflin wrote: > Attached is a small patch for function_base.hpp. On line 302, there is a > T missing. Just a stupid question: Why is it "missing"? What is this patch supposed to fix? Regards, Daniel ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost