60
woops
6y

Seems reasonable

Comments
  • 2
    Try and find the sleep functions and then count the inconsistencies between them 😂😂
  • 2
    what a crippled explanation. Traditionally (in C at least) the return code on success is 0, which is false as a boolean. It also makes much more sense than returning booleans, because then you can have error codes. and there is really only one way the function can succeed, so it should be 0. and it even works terminologically with true and false if you ask: "Did an error occur?"
    So just return false if everything went ok.
  • 1
    @simulate well in modern languages exception are taking care of that matter.
  • 3
    @greg-
    certainly the best solution in most cases, although this requires the exception to be caught appropriately, whereas the return type is intrinsic to the functions type signature and can just aswell be ignored.
  • 0
    @simulate true that :)
  • 0
    @simulate The 0-on-success I think is more of a Unix convention than a C one. In my experience it’s more common for boolean results to be true on success, but it’s probably way less agreed-upon hence running into problems like this.

    In C it’s more common to pass an error handle in and checking to see if it has been set after calling the function.
Add Comment