Skip to content

Conversation

@bugdea1er
Copy link
Owner

According to C99 Rationale, unnamed temporary files are expected to be written first and then read as transparently as possible, so they are created in binary update mode

7.19.4.3 The tmpfile function

The tmpfile function is intended to allow users to create binary “scratch” files. The as if principle implies that the information in such a file need never actually be stored on a file-structured device.
The temporary file is created in binary update mode because it will presumably be first written and then read as transparently as possible. Trailing null-character padding may cause problems for some existing programs.

https://www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10.pdf

I don't see any point in implementing tmp::file in any other way, given that we haven't found a practical use for text or append modes in production for over a year now

@bugdea1er bugdea1er requested a review from Copilot June 16, 2025 17:36

This comment was marked as resolved.

@bugdea1er bugdea1er merged commit 720157b into main Jun 21, 2025
16 checks passed
@bugdea1er bugdea1er deleted the remove-openmode branch June 21, 2025 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants