bug-gnulib
[Top][All Lists]
Advanced

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

Re: C++ aliases in <netdb.h>


From: Bruno Haible
Subject: Re: C++ aliases in <netdb.h>
Date: Sun, 18 Dec 2016 02:16:39 +0100
User-agent: KMail/4.8.5 (Linux/3.8.0-44-generic; KDE/4.8.5; x86_64; ; )

Pedro Alves wrote:
> m4/inet_pton.m4 has this:
> 
>     if test $ac_cv_have_decl_inet_pton = yes; then
>       dnl It needs to be overridden, because the stdcall calling convention
>       dnl is not compliant with POSIX.
>       REPLACE_INET_PTON=1
>       INET_PTON_LIB="-lws2_32"
>     else
>       HAVE_DECL_INET_PTON=0
>       HAVE_INET_PTON=0
>     fi
>   else
> 
> 
> Given the "stdcall calling convention is not compliant with POSIX",
> I wonder whether the right fix would be to somehow cause those
> functions to be replaced too?

>From the point of C programs, replacing 'getaddrinfo' and 'freeaddrinfo'
is overkill, IMO. Most programs just call these functions the way they are
declared in the .h file, through direct call, not through function pointers.

I just added some similar replacements for <math.h> functions that are defined
as inline functions by MSVC. The justification is that <math.h> functions are
occasionally called through function pointers (e.g. you can imagine a 'plot'
function, an 'integrate' function, etc. that takes a float->float function
as a pointer).

>From the point of C++ programs:
  - if you get an error in the .h file, from the _GL_CXXALIAS_SYS or
    _GL_CXXALIASWARN invocation for example, or for GNULIB_NAMESPACE,
    it's worth providing the replacement.
  - if you only get an error in a SIGNATURE_CHECK, it's probably not worth it.
    Just conditionalize the the SIGNATURE_CHECK then.
    But if you want to provide the fix through REPLACE_xxx=1, I won't stop you.

Bruno




reply via email to

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