[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getting EBADF on MSVC
From: |
Bruno Haible |
Subject: |
Re: getting EBADF on MSVC |
Date: |
Mon, 19 Sep 2011 23:37:06 +0200 |
User-agent: |
KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; ) |
Bastien ROUCARIES wrote:
> why not
> #else
> # define TRY_MSVC_INVAL if (1)
> # define CATCH_MSVC_INVAL else do
> # define DONE_MSVC_INVAL while(0)
> #endif
This would be needed if we wanted the user to write
DONE_MSVC_INVAL;
instead of
DONE_MSVC_INVAL
But what's the point of that semicolon? The block does not look like an
expression.
> why not something like:
> #if HAVE_DUP2
> # undef dup2
> # if MSVC_HACK_NEEDED /* NEW */
> # include "msvc-hack.h" /* NEW */
> static int dup2_msvcsafe(int fd, int desired_fd)
> {
>
> }
> # else
> static inline dup2_msvcsafe(int fd, int desired_fd)
> {
> return dup2();
> }
> # endif /* NEW */
>
> int rpl_dup2 (int fd, int desired_fd)
> {
> ...
> result = dup2 (fd, desired_fd);
> ...
> }
Is this code (with a #if and two extra functions) really easier to understand
than what we have in lib/dup2.c now?
> Moreover _get_osfhandle (fd) should be render safe globally.
Yes, that might well be necessary.
> May be we should create a <io.h> module ?
The users of gnulib are not meant to include a file <io.h>, since that's not
in POSIX. So, a gnulib-private header file and a gnulib-private function will
do. Maybe I will call them "io-nothrow.h" and _get_osfhandle_nothrow().
Bruno
--
In memoriam James A. Garfield <http://en.wikipedia.org/wiki/James_A._Garfield>
- getting EBADF on MSVC, Bruno Haible, 2011/09/18
- Re: getting EBADF on MSVC, Bruno Haible, 2011/09/18
- Re: getting EBADF on MSVC, Paul Eggert, 2011/09/19
- Re: getting EBADF on MSVC, Paul Eggert, 2011/09/19
- Re: getting EBADF on MSVC, Eric Blake, 2011/09/19
- Re: getting EBADF on MSVC, Bruno Haible, 2011/09/20
- Re: getting EBADF on MSVC, Bruno Haible, 2011/09/23
- Re: getting EBADF on MSVC, Bruno Haible, 2011/09/23
- Re: getting EBADF on MSVC, Bruno Haible, 2011/09/19
- Re: getting EBADF on MSVC, Paul Eggert, 2011/09/19
- Re: getting EBADF on MSVC, Bruno Haible, 2011/09/20