Yes, I was referring to the isbits portion of stefan’s comment, I should have been clearer about that - sorry! Throwing a UndefVarError for references is certainly well defined behavior (albeit maybe confusing terminology). I’d personally prefer it be called UninitVarError, but that’s a topic for another day.
Gotcha, then there must have been a misunderstanding in the other thread, because the stance that “we shouldn’t use undefined behavior for this” has been my stance there as well. Keno never clarified my question of what exactly he meant with “undefined behavior” ![]()
There is the idea that using calloc instead of malloc would “fix” this across the board, but as it turns out, that also doesn’t quite work; you can easily have a datatype where there is no zero and/or where its bitpattern needs to contain at least one 1, resulting in calloc producing invalid instances yet again. In general, you need to go through a constructor to create valid instances of any type.