Comment Comment by kstenerud C is perfectly capable of type-driven design. He's already got the type (struct), and although C is a bit limited, he can:* return pointer-or-null* choose "invalid" sentinel values and then use birthdate_is_valid(...) to check validity.* Add an is_valid bool field (or even an error enum like in the C++23 example)* Add an out field in the constructor function for the error code (similar to how ObjC does things). parent kstenerud 6 months ago
* return pointer-or-null
* choose "invalid" sentinel values and then use birthdate_is_valid(...) to check validity.
* Add an is_valid bool field (or even an error enum like in the C++23 example)
* Add an out field in the constructor function for the error code (similar to how ObjC does things).