Boost logo

Boost Users :

From: Daryle Walker (darylew_at_[hidden])
Date: 2008-07-18 06:48:03


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. This means that your program is illegitimate and we can't
count it as a counter-example.

-- 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT hotmail DOT 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