News for hackers. Stuff that matters.
Re:What is your take on checking return values? by burfog on Wednesday September 02, 2020 @10:16PM (#24360264)
No, wait, like this:

  void got_error(void){
    char err[] = "Error!\n";
    int len = strlen(err);
    int ret = printf(err);
    if(len != ret)
      got_error();
  }
Obviously, if the error routine faces an error, it should call the error routine. That is how you handle errors.

Er, but maybe the error routine should also return an error flag in that case? The caller could then check it and call the error routine if needed.

There are no comments on this comment yet.