News for hackers. Stuff that matters.
Re:What is your take on checking return values? by burfog on Wednesday September 02, 2020 @08:00PM (#24359573)
Be sure that your error-handling code checks for errors.

  while(printf("Error!\n")+1 != sizeof "Error!\n")
    ;
Also, it should be bug-free.
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.