3 ms·
To be fair, the issue of ergonomics is an artifact of C only. In a language with proper sum types (or as I like to think of them, "better enums"), the pattern w
by Twisol 8y ago
To be fair, the issue of ergonomics is an artifact of C only. In a language with proper sum types (or as I like to think of them, "better enums"), the pattern would look more like this:
match library_function(arg) {
Ok(num) => // success
Err(errno) => // failure
}
But since C doesn't have proper sum types, we have to approximate this pattern with things like errno or returned structs.