std.file.read implementation contest

Sean Kelly sean at invisibleduck.org
Mon Feb 16 13:57:37 PST 2009


Andrei Alexandrescu wrote:
> Someone mentioned an old bug in std.file.read here:
> 
> http://www.reddit.com/r/programming/comments/7xnty/walter_bright_on_porting_d_to_the_mac/ 
> 
> 
> Two programmers sent in patches for the function. Which is to be 
> committed and why? (Linux versions shown. Apologies for noisy line breaks.)

Neither one.  std.read is intended to read the contents of a file in 
bulk into memory.  If a file size is zero then the size of the data 
available is either zero (expected case) or unbounded (screwy *nix 
case).  Streaming operations should be used on unbounded virtual files, 
not std.read.


Sean



More information about the Digitalmars-d mailing list