digitalmars.D.learn - ErrorException thrown when errno is modified ?
- chmike (8/8) May 19 2016 Hello,
- ag0aep6g (6/13) May 19 2016 I think the description for ErrnoException is a bit misleading. I'm
- Adam D. Ruppe (4/7) May 19 2016 It just means the Phobos functions that use these functions (like
- Alex Parrill (5/14) May 19 2016 ErrnoException is the exception thrown by errnoEnforce, which is
Hello, I'm planning to call some posix functions core.sys.posix that may set the errno value in case of error. e.g. read() or write(). Checking the std.exception documentation I see that ErrnoException may be thrown when errors setting errno may occur. Does this affect the posix calls ? From what I saw in the code, it doesn't seam the case. Just making sure I'm correct.
May 19 2016
On 05/19/2016 03:05 PM, chmike wrote:I'm planning to call some posix functions core.sys.posix that may set the errno value in case of error. e.g. read() or write(). Checking the std.exception documentation I see that ErrnoException may be thrown when errors setting errno may occur. Does this affect the posix calls ? From what I saw in the code, it doesn't seam the case. Just making sure I'm correct.I think the description for ErrnoException is a bit misleading. I'm fairly certain that there is no code running that watches errno and throws an ErrnoException whenever it gets set. Rather, code that calls C functions which set errno can/should use ErrnoException and the errnoEnforce helper function to make a nice Exception from an errno value.
May 19 2016
On Thursday, 19 May 2016 at 13:05:19 UTC, chmike wrote:Checking the std.exception documentation I see that ErrnoException may be thrown when errors setting errno may occur. Does this affect the posix calls ?It just means the Phobos functions that use these functions (like std.file or std.socket) might throw the exception, not the C functions themselves.
May 19 2016
On Thursday, 19 May 2016 at 13:05:19 UTC, chmike wrote:Hello, I'm planning to call some posix functions core.sys.posix that may set the errno value in case of error. e.g. read() or write(). Checking the std.exception documentation I see that ErrnoException may be thrown when errors setting errno may occur. Does this affect the posix calls ? From what I saw in the code, it doesn't seam the case. Just making sure I'm correct.ErrnoException is the exception thrown by errnoEnforce, which is a convenient function for checking system calls. D links to the same Posix functions that C does; their behavior is exactly the same (ie they don't throw).
May 19 2016