Originally Posted by
JVene
In the OP's question, state may be independent of value. The value may be uninitialized garbage if it is known that the state is null.
If the state is not null, the value should contain meaningful data, which includes zero.
Hence, the suggestions of using <0 as a 'signal' of state (something we simply agree upon, like zero being state for a pointer).
Or, the suggestions that a separate bool be used to indicate state, perhaps documenting that false indicates NULL, true indicates valid data.