| ▲ | XorNot 6 hours ago | |||||||
The problem with let's get rid of NULL is that it's a real, required state. The vast majority of computing is actually not binary: any real input generally has at least 3 possible states: not set, true and false. In practice really 4 because "indeterminate" is a reasonable error condition you'd like to know about. And it keeps increasing anyway: e.g. not set has subcategories: not set due to lack of user input, not set because we're loading state from the backend etc. NULL is the first expression of that basic problem: it's definitely not enough to eliminate NULL because the first thing which happens is your non pointer default value takes it's place. | ||||||||
| ▲ | lambdaone 5 hours ago | parent | next [-] | |||||||
What you are describing is option types, which are an entirely valid and very useful construct that helps make programs more rather than less reliable. But you need proper language type system support and compile-time enforcement to make it work, and C does neither of those. | ||||||||
| ||||||||
| ▲ | 5 hours ago | parent | prev [-] | |||||||
| [deleted] | ||||||||