all OS functions should be "nothrow @trusted @nogc"
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jul 25 08:50:59 PDT 2017
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.
-Steve
More information about the Digitalmars-d
mailing list