Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2008-07-18 06:57:17


on Fri Jul 18 2008, Daryle Walker <darylew-AT-hotmail.com> wrote:

> On Jul 18, 2008, at 5:07 AM, Daryle Walker wrote:
>
>> On Jul 17, 2008, at 10:32 PM, David Abrahams wrote:
>>>
> [SNIP]
>>> Then, if I understand you correctly, none of the built-in types are
>>> Assignable.
>>>
>>> char* p; // p is unintialized
>>> char* q = p; // invalid
>>>
>>> Yes, uninitialized is one of the valid states for a builtin type,
>>> i.e. part of the type's invariants.
>>
>> Really, I was wondering about that (corner) case, especially since
>> it can't be replicated (i.e. it's undefined to use such a state as
>> a source). I'm thinking more about non-POD class types, which must
>> have an initial state with the internal primitive objects
>> initialized.
>
>
> Well, I looked into it further. In C++ 2003, section 4.1 "Lvalue-to-
> rvalue conversion" [conv.lval], paragraph 1, an uninitialized object
> can only be used as an lvalue, converting it to a rvalue is undefined
> behavior.

Yes, that's what "// invalid" means.

> This means that your program is illegitimate and we can't count it as
> a counter-example.

Huh? By that logic no counterexample is possible. Or am I missing
something?

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net