Boost logo

Boost-Build :

From: K. Noel Belcourt (kbelco_at_[hidden])
Date: 2006-12-02 20:48:37


On Dec 2, 2006, at 6:32 PM, Caleb Epstein wrote:

> On 12/2/06, K. Noel Belcourt <kbelco_at_[hidden]> wrote:
>> From Sun's CC manpage,
>>
>> [no%]tmplife (Standard mode only) [Do not] Clean
>> up the temporary objects that are
>> created by an expression at the end
>> of the full expression, as defined
>> in the ANSI/ISO C++ Standard.
>> (When -features=no%tmplife is in
>> effect, most temporary objects are
>> cleaned up at the end of their
>> block.) The default is no%tmplife.
>>
>> Which I read to mean that -features=tmplife leaves temporary files
>> scattered around.
>
> Nothing of the sort. It has to do with the lifetime of temporaries
> created in expressions like:
>
> void foo (const std::string& arg) { ... }
>
> void func () {
> foo ("bar"); // [1]
> // more stuff...
> } // [2]
>
> With Sun CC's default (-no%tmplife), the unnamed temporary std::string
> created for the call to foo would not be destroyed until the enclosing
> scope exits ([2] above). A conforming compiler (and Sun CC with
> -tmplife) will destroy the temporary at [1]. In the case of
> std::string this side-effect is harmless, but for more "interesting"
> types the default behavior could be disastrous.

Oh, cool. Thanks for the explanation (I've never used the option as
you can tell).

-- Noel


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk