Boost logo

Boost :

Subject: Re: [boost] [type_traits] Variadic function pointer with __fastcall calling convention
From: Edward Diener (eldiener_at_[hidden])
Date: 2013-10-06 19:01:59

On 10/5/2013 4:02 PM, Stephan T. Lavavej wrote:
> [Edward Diener]
>> The problem from clang's perspective is that they must emulate this
>> "feature" <g> to compile Boost type_traits. Their developers feel that
>> Boost type_traits should not depend on this feature, ie. should not
>> specify any VC++ calling conventions for varargs function or function
>> template declarations.
> I agree with clang's devs (because that's what VC's <type_traits> does).

Thanks for the encouragement. I will quote you when I propose to John
Maddock, the main Boost type_traits implementor, that Boost should so
the same.

>> What I mean is that in VC++ the declarations are redundant, being the
>> same template redeclared.
> Right. So if you want to absorb all old-style varargs, you need only one overload/specialization.

It looks as if the overload specialization for C++ should specify
__cdecl. If this is left out of a function specification, is not the
default calling convention user-specified, with __cdecl being the
default ? So if the end-user changes the default to something other than
__cdecl is that considered the end-user's fault with VC++ ?

>> In this case clang either has to change to be like VC++
> Oh, I thought clang was attempting to be VC-compatible here (like our copy of EDG for Intellisense does).

I believe that clang wants to be compatible enough to VC++ on Windows to
be able to compile Windows header files, but still wants to follow the
C++ standard as closely as possible. Of course it is a bit of a
tightrope act because 3rd party libraries for Windows which test for
VC++ using _MSC_VER and other VC++ macros which clang on Windows
supports, may want to be able to use clang to compile the code also.

> If clang is supposed to be VC-compatible, then they should treat varargs with calling conventions like VC does, and Boost should do what VC <type_traits> does (i.e. one overload/specialization with no calling convention - or __cdecl would work, I think).

It seems as if __cdecl is better than no calling convention, because the
end-user has the ability to change the default calling convention on VC++.

> If clang wants to be different from VC, then Boost should do something different for clang and VC.

I do not work developing clang but I am just trying to compile Boost
code with the clang toolset.

Boost list run by bdawes at, gregod at, cpdaniel at, john at