Boost logo

Boost :

Subject: Re: [boost] [Polygon] review - isotropy.hpp
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2009-08-31 11:13:23


Simonson, Lucanus J
> Stewart, Robert wrote:
> > Simonson, Lucanus J wrote:
> >> Steven Watanabe wrote:
> >>
> >>> isotropy.hpp:308
> >>> What does y_c_edist mean, and why are you including a
> >>> constant in the gtl_and for euclidean_distance?
> >>
> >> This is a compiler workaround for MSVC8. There are a large
> >> number of them, unfortuantely. It is named with a mangling
> >> scheme related to the concept and function name that uses it.
> >> MSVC8 has two different code paths for instantiating
> >> templates and applying SFINAE. The one where it recognizes
> >> that it has seen a subtemplate before is incorrect and I used
> >> these constant types that are unique to each function to
> >> force MSVC8 to SFINAE correctly. I could perhaps put a
> >>
> >> //MSVC8 workaround
> >>
> >> on each one so that it doesn't cause too much confusion.
> >
> > (Caveat: I'm only responding to what I read here: I haven't
> looked at
> > the code in question. I may be way off the mark.)
> >
> > How about introducing a macro taking a constant argument, that
> > evaluates to the supplied constant, plus required punctuation, for
> > MSVC8 and to nothing for other compilers? That would make the code
> > self documenting and eliminate any #ifdef's where used.
> >
> > BOOST_POLYGON_MSVC8_SFINAE_WORKAROUND?
>
> The constant needs to be a unique type in each instance that
> the workaround is used. Also, there are no ifdefs used for
> this workaround because the code is legal in all compilers.

Fair enough. However, allow me two points. First, the unique type can be produced from the constant supplied to the macro. Second, one day you might actually drop support for MSVC8 and removing the invocation of a macro that you can search for easily, would make quick work of reverting to the syntax you wanted all along.

Thus, the macro can inject the extra type for MSVC8 only, leaving other compilers with the simpler code, which probably means reduced compilation time; the macro documents that the extra type is for MSVC8 only; and you have an easier way to remove the noise later.

_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk