[clang] [clang][analyzer][NFC] Use `*EofVal` instead of constant `-1` (PR #73072)

via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 22 07:04:08 PST 2023


https://github.com/DonatNagyE requested changes to this pull request.

I don't think that this is a correct change, as according to the C standard "On failure, the ftell function returns −1L and stores an implementation-defined positive value in errno." [1]

Note that this is different from the functions like `fscanf` where the same standard writes "The fscanf function returns the value of the macro EOF if an input failure occurs before the first conversion (if any) has completed."

Also note that your comment "EOF might be a different value than -1" implies that the "[NFC]" tag is inappropriate for this commit (because it _does_ change behavior on those systems where `EOF != -1`). 

[1] Quoted from a freely available draft version of the C11 standard: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf  A similar draft of C99 contains the same sentence.

https://github.com/llvm/llvm-project/pull/73072


More information about the cfe-commits mailing list