balazske added a comment.

The problem with `fgetc` is here that the returned value indicates not only if 
there was failure or not. In the following (over simplified) example no warning 
is needed even if there is no check for EOF. Because this case, for such kind 
of functions any comparison of the return value should be treated as an error 
check. Similar functions are the `strtol` family.

  c = fgetc(fd);
  if (c == 'a') {
    // this is the expected input
  } else {
    // any other value is handled as error
  }


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72705/new/

https://reviews.llvm.org/D72705



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to