std.MmFile.Mode.readCopyOnWrite documentation/implementation

Bastiaan Veelo Bastiaan at Veelo.net
Mon Jun 3 09:11:41 UTC 2019


Currently[1], std.MmFile.Mode.readCopyOnWrite is documented as

> readCopyOnWrite, /// Read/Write existing file, copy on write

When I test that on Windows, what seems to happen is that when 
written to, memory is copied and the copy is no longer backed by 
a file. So changes are not persistent and I think this should be 
clarified in the documentation. This mode will not change the 
file, and Read/Write should actually be Read, I would think. But 
marking the file read-only will cause this to fail, as the file 
is actually opened Read/Write in the implementation, and I wonder 
whether it should be opened read-only instead. The implementation 
is platform-specific, so what works on one might not work on the 
other.

Any input on this?

Bastiaan.

[1] 
https://github.com/dlang/phobos/blob/841541fca9c8c0224f3d47ef11db219a9fa5e065/std/mmfile.d#L64


More information about the Digitalmars-d mailing list