August 17, 2004 Re: Setting errno? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <newshound@digitalmars.com> skrev i en meddelelse news:cfs2ol$kr9$1@digitaldaemon.com... > > What about windows? errno exists on windows too. > errno really only exists in the windows C compiler runtime libraries as an attempt to fake the unix errno behavior. It is not part of the Windows API. > My intention is to skip the errno "middleman" on Win32 and go straight to the Win32 API, where GetLastError() does the trick. I think this is an unhealthy decision for several reasons: 1. I remember using C functions where the only way to determine if an error occurred or not, was to reset errno first, call the function, and then check if errno had been set. Without setErrno() such functions are rendered useless. 2. D might be used to implement libraries callable from C. setErrno() might be needed to communicate errors back. Without it an otherwise unneccesary layer of wrapping will be needed - something that I believe you yourself has strong negative feelings about. 3. In a multithreaded application, a thread-instance of errno is way better than SetLastError() and GetLastError(). 4. Leaving setErrno() out on Windows, you are placing an extra burden on the D developer that needs to maintain portable code. I hope this will help you reconsider. Regards, Martin |
August 18, 2004 Re: Setting errno? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin M. Pedersen | "Martin M. Pedersen" <martin@moeller-pedersen.dk> wrote in message news:cftl46$1cng$1@digitaldaemon.com... > "Walter" <newshound@digitalmars.com> skrev i en meddelelse news:cfs2ol$kr9$1@digitaldaemon.com... > > > What about windows? errno exists on windows too. > > errno really only exists in the windows C compiler runtime libraries as an attempt to fake the unix errno behavior. It is not part of the Windows > API. > > My intention is to skip the errno "middleman" on Win32 and go straight to the Win32 API, where GetLastError() does the trick. > > I think this is an unhealthy decision for several reasons: > > 1. I remember using C functions where the only way to determine if an error occurred or not, was to reset errno first, call the function, and then check if errno had been set. Without setErrno() such functions are rendered useless. > > 2. D might be used to implement libraries callable from C. setErrno() might be needed to communicate errors back. Without it an otherwise unneccesary layer of wrapping will be needed - something that I believe you yourself has strong negative feelings about. > > 3. In a multithreaded application, a thread-instance of errno is way better > than SetLastError() and GetLastError(). Are you saying the the Win32 error number is not thread-specific? If so, that's not correct. > 4. Leaving setErrno() out on Windows, you are placing an extra burden on the D developer that needs to maintain portable code. > > > I hope this will help you reconsider. I agree. |
August 18, 2004 Re: Setting errno? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | "Matthew" <admin.hat@stlsoft.dot.org> skrev i en meddelelse news:cfu9io$1lpv$1@digitaldaemon.com... > Are you saying the the Win32 error number is not thread-specific? If so, that's not correct. No, I have found that out by now. Well, three out of four is not bad :-) Regards, Martin |
Copyright © 1999-2021 by the D Language Foundation