Boost logo

Boost :

Subject: Re: [boost] [type_traits] Variadic function pointer with __fastcall calling convention
From: Marc Glisse (marc.glisse_at_[hidden])
Date: 2013-10-12 04:49:33


On Wed, 9 Oct 2013, Edward Diener wrote:

> On 10/8/2013 3:59 AM, Marc Glisse wrote:
>> On Mon, 7 Oct 2013, Stephan T. Lavavej wrote:
>>
>>>> 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.
>>>
>>> Well, calling conventions are non-Standard.
>>
>> extern "C" is, among other things, a calling convention, so treating
>> other calling conventions the same way could arguably be called "the
>> standard way". Now there are several defects about the handling of
>> extern "C", so it may not be that helpful...
>
> There is no mention of calling conventions in the C++ standard so specifying
> extern "C" as one seems a bit of a stretch.

You didn't look closely enough. Language linkage was made part of a
function's type precisely to support a different calling convention.

[expr.call]
Calling a function through an expression whose function type has a
language linkage that is different from the language linkage of the
function type of the called function¢s definition is undefined (7.5).

[dcl.link]
Some of the properties associated with an entity with language linkage are
specific to each implementation and are not described here. For example, a
particular language linkage may be associated with a particular form of
representing names of objects and functions with external linkage, or with
a particular calling convention, etc.

-- 
Marc Glisse

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