Re: ErrorException thrown when errno is modified ?

2016-05-19 Thread Adam D. Ruppe via Digitalmars-d-learn

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.


Re: ErrorException thrown when errno is modified ?

2016-05-19 Thread Alex Parrill via Digitalmars-d-learn

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).


Re: ErrorException thrown when errno is modified ?

2016-05-19 Thread ag0aep6g via Digitalmars-d-learn

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.


ErrorException thrown when errno is modified ?

2016-05-19 Thread chmike via Digitalmars-d-learn

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.