www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13893] New: "rawRead must take a non-empty buffer"

https://issues.dlang.org/show_bug.cgi?id=13893

          Issue ID: 13893
           Summary: "rawRead must take a non-empty buffer"
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: thecybershadow gmail.com

If an empty buffer is passed to rawRead, it throws.

This is a somewhat arbitrary limitation, and, in the generic case that the
buffer a program may want to read would happen to have a length of 0, a
needless corner case the programmer must be aware of. (I've had a long-running
program crash half-way through because of this.)

Empty buffers are OK with the following:
- File.rawWrite
- fread
- Socket.send
- Socket.receive (although maybe this one shouldn't be, as its return value is
then ambiguous).

--
Dec 25 2014