Boost logo

Boost :

Subject: Re: [boost] [thread] Compiler eoorrs while running the tests
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2010-05-21 04:01:11


"vicente.botet" <vicente.botet_at_[hidden]> writes:

> ----- Original Message -----
> From: "Anthony Williams" <anthony.ajw_at_[hidden]>
>
> Have 10.1/Darwin, vacpp/AIX and gcc 4.3.4/FreeBSD rvalue references when running on C++098 mode?

I don't know about Intel 10.1 or vacpp, but gcc 4.3.4 only has rvalue
references in C++0x mode.

> I don't undesrtand how this test can work with your move semantics emulation?
>
> boost::thread make_thread_return_local(boost::thread::id* the_id)
> {
> boost::thread t(do_nothing,the_id);
> return t;
> }

It's the NRVO optimization --- the named object is constructed directly
in the return value rather than copied. Many compilers do the
optimization, but they are supposed to check for an accessible copy
constructor anyway.

The compilers it works on must skip the required check for an accessible
copy constructor, so they are not strictly conforming to C++98, but in
this case it's a bonus. In C++0x this is also required to work if the
object being returned has an accessible move constructor.

Anthony

-- 
Author of C++ Concurrency in Action     http://www.stdthread.co.uk/book/
just::thread C++0x thread library             http://www.stdthread.co.uk
Just Software Solutions Ltd       http://www.justsoftwaresolutions.co.uk
15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976

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