bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getting EBADF on MSVC


From: Paul Eggert
Subject: Re: getting EBADF on MSVC
Date: Mon, 19 Sep 2011 15:37:47 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.22) Gecko/20110906 Fedora/3.1.14-1.fc14 Thunderbird/3.1.14

On 09/19/11 14:37, Bruno Haible wrote:
> Is this code (with a #if and two extra functions) really easier to understand
> than what we have in lib/dup2.c now?

I find it easier to understand, because I can safely ignore
the stuff that's inside the "#if MSVC ..." brackets.

On 09/19/11 14:15, Bruno Haible wrote:
> I don't see why a lack of MSVC knowledge would prevent anyone from modifying
> these files. The code structure and intent are clear enough.

They may be clear to someone who understands MSVC and its exception
handling principles, but they are not clear to people who don't
understand them, and the rest of us should not have to understand
them.  It's OK to add support for MSVC, but it's not OK for this
support to pose a significant burden on GNU and GNUish platforms.

I'm not objecting to this MSVC stuff if it's put inside areas that are
"#ifdef _WIN32" or are otherwise clearly marked so that they are for
Windows only, and which the rest of us can safely ignore.  But the
style used in dup2.c is cluttering code that is otherwise perfectly
clear on mainstream (non-Windows) platforms.  We should separate the
Windows concerns from the mainstream code, as much as possible, even
if that makes the code a bit more cluttered for Windows developers.

For example, it's not reasonable to replace code like this:

  return dup2 (a, b);

with code like this:

  TRY_MSVC_INVAL
    {
      return dup2 (a, b);
    }
  CATCH_MSVC_INVAL
    {
      errno = EBADF;
      return -1;
    }
  DONE_MSVC_INVAL

Oh, but wait a minute, that MSVC replacement doesn't work, because one
is not allowed to do a "return" inside a "TRY...".  Arrggh!

We need something better.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]