What is Indeterminate value?

The differentiation of the two (indeterminate values and trap representations) is fundamental. In one case you have no known value. In the other you have a known-invalid value.

Simplest example of an indeterminate value I can muster:

int a;
int b = a;

There is no concept of determinate ‘value’ associated with a. It has something (as it is occupying memory) but the “what” it has is not defined, thus indeterminate. Overall, the concept is as simple as it sounds: Unless it has been decided what something is, it cannot be used in any evaluation (think r-value if it helps) with deterministic results.

The actual value depends on the language, compiler, and memory management policies. For instance, in most implementations of C, an uninitialized scope variable or the memory pointed to by the pointer returned by a call to malloc will contain whatever value happened to be stored at that address previously. On the other hand, most scripting languages will initialize variables to some default value (0, “”, etc).

Regarding Trap Representation, it is essentially any value that is outside the restricted domain of the allowable values pertaining to the underlying formal definition. A hopefully non-confusing example follows. :

enum FooBar { foo=0, bar=1 };
enum FooBar fb = (enum FooBar)2;

In general it is any bit pattern that falls within the space allowed by the underlying storage representation (in enums that is likely an int) but is NOT considered a valid “value” for the restricted domain of its formal definition. An outstanding description on trap representations and their roots can be found at this answer. The above is just a representative of what a very simple known-invalid representation may appear as. In reality it is practiced in hardware for detection of values that trigger invalid-state. I think of them as “panic” values. Again, the above code is solely idealistic in demonstrating the concept of a “value” this is not “valid”, but is, in fact, known.

Leave a Comment