Re: [sigc] C++0x lambdas



On Fri, 2012-01-06 at 19:15 +0800, Chow Loong Jin wrote:
> On 06/01/2012 03:16, Rui Maciel wrote:
> > On 01/05/2012 04:05 PM, Chow Loong Jin wrote:
> >> The only macro I can find to do with detecting C++0x is
> >> __GXX_EXPERIMENTAL_CXX0X__ which is probably not portable. __cplusplus is
> >> supposed to be defined to a value greater than 199711L, but on my system it
> >> seems to be defined without a value, defaulting to 1.
> > After a bit of digging, a bug report has already been filed for this problem. 
> > It was filed in 2001 and it appears to have been fixed in October 2011.  Here is
> > a link to the bug report.
> > 
> > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=1773
> > 
> > So, basically the __cplusplus macro will work with GCC 4.7.  Previous releases
> > will be left broken.
> 
> Interesting, so for handling gcc something like the following should work, I guess.
> 
> -----8<-----
> #if __cplusplus >= 201100L || defined (__GXX_EXPERIMENTAL_CXX0X__)
> ...
> #endif
> ----->8-----
> 
> But how should we handle MSVC or other compilers?
> 
> 
> That said, C++98 code could also benefit from this addition since it allows the
> use of out-of-sigc++ functors. I have managed to amend the implementation to
> compile with -std=c++98, but it requires BOOST_TYPEOF. Perhaps we could isolate
> the BOOST_TYPEOF implementation for inclusion into sigc++?

Instead of checking for particular compiler versions, we would generally
add a test that is run during configure time. That would test for the
compiler capability. There are already several tests like this in
libsigc++.


-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]