On 13.06.2012 13:16, Alex Rønne Petersen wrote:
Hi,

In File.rawWrite() (in std.stdio), there is the following error checking code:

         auto result =
             .fwrite(buffer.ptr, T.sizeof, buffer.length, p.handle);
         if (result == result.max) result = 0;
         errnoEnforce(result == buffer.length,
                 text("Wrote ", result, " instead of ", buffer.length,
                         " objects of type ", T.stringof, " to file `",
                         p.name, "'"));

Call me silly, but I don't understand the `result == result.max` check. See:

Obviously it counts on fwrite to return -1 on error. I'd say it's a carry over from when code (supposedly) used POSIX write call directly.


--
Dmitry Olshansky

_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to