On Jul 17, 2008, at 10:32 PM, David Abrahams wrote:
on Thu Jul 17 2008, Daryle Walker
wrote: [SNIP]
Let's define some stuff here: T: some type you created, probably a class type a: an object of type T; it's valid, i.e. meets its invariants b: another object of type T, also valid; any similarities or differences in its state from a's state is unspecified C: the set of all valid states an object of type T may have
Let function F: x -> Y, map a T object state x to a (sub)set of C named Y. This function returns the subset of source states that a given state can receive during an assignment.
If there exists at least one x in C such that F(x) = Y < C, then type T is _NOT_ Assignable! In other words, the number of assignment- compatibility classes in T must be exactly one for T to be Assignable.
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. -- Daryle Walker Mac, Internet, and Video Game Junkie darylew AT hotmail DOT com