Boost logo

Boost :

Subject: Re: [boost] [winapi] Problem with the latest clang on Windows
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2015-06-05 03:04:51


On 2/06/2015 18:34, Edward Diener wrote:
> The reply from clang was quick on the bug report:
>
> "The problem is that the two function declarations have different
> parameter types. The windows.h version takes ::_FILETIME*, whereas the
> boost version takes boost::detail::winapi::_FILETIME*. Because they're
> 'extern "C"' functions, they are redeclarations of the same function,
> and are ill-formed because they have different types."
>
> I have asked for the appropriate place in the C++ standard which
> justifies the error.

Standard or no, it does make sense that this should at least be a
warning, if not an error, unless the compiler can prove that the two
types really are binary compatible (and even that is still dubious
because it *can't* prove that they're semantically compatible).
Accidental parameter incompatibilities in C functions is the source of
many hard-to-locate bugs.

What is the reason that Boost WinAPI redeclares the structure? Can it
be changed to just use the one from the Windows headers (perhaps via
typedef, if the internal typename is needed for compatibility)?

(After writing the above, a cursory glance at the code suggests that it
does do that if BOOST_USE_WINDOWS_H is defined. So that changes the
question: under what conditions is that not defined?)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk