mesa
mesa copied to clipboard
Add checks for uninitialized integers?
Something I found while fixing thinags in 13837 is that we don't currently have anyway to set integer arrays (and I presume scaler ints) to an invalid value to check for uninitialized values. For floats we can set things to a nan. Maybe we should expand the set_nan code to set int arrays to -huge(int) as an invalid value? We won't get the nice crash on use we get with a nan but at least it will be easier to see when we haven't set an array properly.
I think using -huge(int) is a good plan. We could also add an is_bad interface that supports integers and just checks for the -huge(int) value.
-Adam On May 31, 2020, 4:37 PM -0400, Robert Farmer [email protected], wrote:
Something I found while fixing thinags in 13837 is that we don't currently have anyway to set integer arrays (and I presume scaler ints) to an invalid value to check for uninitialized values. For floats we can set things to a nan. Maybe we should expand the set_nan code to set int arrays to -huge(int) as an invalid value? We won't get the nice crash on use we get with a nan but at least it will be easier to see when we haven't set an array properly. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
If we do this I suggest we don't call it set_nan
and instead call it set_bad
. Then it's clearer that we're setting bad values (which means NaN for reals but -huge(int) for ints).