On 2012.09.16 12:59, Peter Stuge wrote:
> Pete Batard wrote:
>> the error basically comes
>> from trying the following: _open("NUL", _O_WRONLY);
>
> I don't understand why the fd integer is allocated using _open()
> instead of allocating it in the library using a simple counter or so.

Because "using a simple counter or so" requires more lines of codes to 
ensure we are emulating fd allocation than a one line call to the OS.

If I had reasons to suspect that _open would not work on some stripped 
down version of Windows, I may have used something else. Except I didn't 
(and I don't see the limitation we've seen here, for which we appear to 
have a workaround, as something that requires urgent attention). In 
terms of stability and ease of implementation, you really can't beat an 
_existing_ OS call returning the data you need.

As a matter of fact, if I had not used an OS call to return an fd, and 
added my own custom implementation, I'm pretty you would have been the 
one to ask "Since you need an fd-like thingy, why don't use just use an 
OS call that returns an actual fd?"

Regards,

/Pete

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://ad.doubleclick.net/clk;258768047;13503038;j?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to