2 ms·
C has non-nullable types too. Only one type can be null in C, and in that event it signifies an absence of a value of that type.
by 90s_dev 1y ago
C has non-nullable types too. Only one type can be null in C, and in that event it signifies an absence of a value of that type.
- freeone3000 1y agoSure, but practically, that type is used so commonly that such a distinction is useless. Can I get a FILE? I guess I can get a FILE*…
- 90s_dev 1y agoRight, so check if it's null. In practice, you do it just as often in C as you check for std::nullopt in C++ or std::option::ok in Rust etc.
- remexre 1y agoOnce I check if an Option/optional/Maybe is none, I can extract the value and just pass around the value, so other functions I call know that the value cannot be null. This does not work well for FILE in C, for instance.