On 07/25/2017 11:50 AM, Steven Schveighoffer wrote:
On 7/25/17 11:26 AM, Andrei Alexandrescu wrote:

About http://man7.org/linux/man-pages/man2/read.2.html, there's just a bit of wrapping necessary:

nothrow @trusted @nogc
ssize_t read(int fd, ubyte[] buf)
{
     return read(fd, buf.ptr, buf.length);
}

(btw void[] doesn't work)

[snip]
A suite of safe wrappers on OS primitives might be useful.

Great idea! Should it be a package on its own, or should we put the wrappers inside the original files?

That is, do we make

core.sys.safe.posix.unistd: read

or do we make

core.sys.posix.unistd: safe_read

?

My preference is for the former, since it's very nice to have a pristine copy of the header file.

Same here. I'd preserve the function name though. -- Andrei

Reply via email to