$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [smart_ptr] Interest in the missing smart pointer (that can target the stack)
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2016-01-30 14:16:46
AMDG
On 01/30/2016 11:31 AM, Noah wrote:
> On 1/29/2016 7:00 PM, Rob Stewart wrote:
>>
>> Many times I don't want to initialize a variable because the branches
>> in the subsequent code select the value. Do your wrappers provide a
>> constructor that permits leaving the value uninitialized?
>
> So first let me say that I'm not proposing a total ban on primitive
> types. When you need the performance, and primitive types give you the
> performance, use them. But that should be small fraction of the world's
> total C++ code. What is antiquated, in my opinion, is that primitive
> types are the still the default. In terms of not wanting to initialize
> due to subsequent conditional assignment, I would say don't
> underestimate the compiler optimizer. When the optimizer can figure out
> that the default initialization is redundant, it will remove it for you,
> right?
It's not just about optimization. Initializing
a variable with a bogus value is no more correct
than leaving it uninitialized, and also prevents
tools like valgrind from detecting any real problems.
In Christ,
Steven Watanabe