by RustyRussell · 3y ago · 0 comments
Not because these functions couldn't handle it, but because this assertion simplifies optimizations elsewhere.
This has required adding extra checks in my code, found mainly by trial and error, and has made it less readable and less optimal.
Finally, the checked arithmetic operations returning false on success is a horror show. Fortunately it will be found on the first time the code is run, but that's a damnably low bar :(
This seems in line with C conventions? Generally a 0 return code means success.
“If checked operation has a status, then it failed.” - ok
“If checked operation [is true], then it failed.” - wat
Which C historically did not have, so int played that role. The function is the same, and the existing idioms remain.
Ah, anyway, standard C/libc is basically a lost cause. It can’t get any worse, since you have to refer to a manual at every call to not step on a landmine.
That's what got you? C functions returning error flags (with zero meaning no error) isn't exactly new.