I think your interpretation is close, but not exactly right.
uninitialized
means the memory is reserved, but not filled with meaningful data. An easy example:
int* ptr;
All this does is reserve a piece of memory to contain the pointer, but since there is no int yet, the value of that pointer is not altered and contains a random garbage address to a meaningless location.
Another example:
class MyClass
{
int a;
int b;
MyClass() :
a(b) //Oops
b(5)
{ }
}
int b
is not initialized yet when using it for a
and, again, contains random garbage.
An indeterminate
state is when the object has been initialized, but (probably because it is not intended to be used anymore) you don't know what's inside it.
Its behaviour is unpredictable, but not invalid (unless, of course, the documentation says it's invalid as well). For instance:
std::string a("text");
std::string b(std::move(a));
string a
is now probably just an empty string. Accessing it will not cause undefined behavior, it will behave like any other empty string. Except you don't know for sure that it's empty.
For all you know, it might have replaced its char array with a reference to some static const char array saying "this is an indeterminate object why are you accessing me leave me alone."
. Or some complicated series of seemingly random characters that is the result of internal optimizations. You can't know what is in it, and shouldn't use it. But when you do, it won't give you undefined behavior. Just useless behavior, on undefined data.
default-initialization
and value-initialization
are not part of your main question, you should ask for those in a separate question (assuming you can't find the answer on this site already).