Conversation
|
Thanks for your contribution. |
|
Title now including reference to C11 and removed reference to Windows 11.
I added a test in test/testio.cpp. Anything missing in it ? |
Thanks, I must have missed that. |
|
Ping @danmar |
danmar
left a comment
There was a problem hiding this comment.
I feel we need to have a ticket for this in trac
it feels like it should be added to the release notes as a "new check" ?
lib/checkio.cpp
Outdated
| case Filepointer::Operation::UNIMPORTANT: | ||
| if (f.mode == OpenMode::CLOSED) | ||
| useClosedFileError(tok); | ||
| if (isftell && windows && f.read_mode == Filepointer::ReadMode::READ_TEXT && printPortability) |
There was a problem hiding this comment.
the error message says something about the C11 standard. Nothing about windows.
There was a problem hiding this comment.
I will add a comment about this reference to this Microsoft page:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/ftell-ftelli64?view=msvc-170
An update for the error message with this, would it be OK ?
According to Microsoft, the value returned by ftell may not reflect the physical byte offset for streams opened in text mode, because text mode causes carriage return-line feed translation. See also 7.21.9.4 in C11 standard.".
I will remove the reference to _wfopen(), it's not part of the C++ standard.
test/testio.cpp
Outdated
| " (void)ftell(f);\n" | ||
| " fclose(f);\n" | ||
| " }\n" | ||
| "}\n", dinit(CheckOptions, $.platform = Platform::Type::Win32A, $.portability = true)); |
There was a problem hiding this comment.
test what happens on unix platform . test what happens when C99 is used - that works as expected right?
There was a problem hiding this comment.
Selecting Win32A is too limiting, it should apply to all platforms for portability.
|



Some legacy tools stopped suddenly working after 20+ years.
https://stackoverflow.com/questions/79762122/ftell-no-more-returning-the-correct-offset-on-a-text-file-with-windows-11-ente