Topic: extern "C" inline allowed?


Author: kuyper@wizard.net (James Kuyper)
Date: Wed, 9 Jun 2004 17:08:56 +0000 (UTC)
Raw View
vishal_kochhar@hotmail.com (vishal) wrote in message news:<40C5E842.DF6622E5@yahoo.com>...
> Hi,
>
> Is extern "C" inline allowed by the standard and if so would it have C
> linkage if it were used out-of-line? I have seen different behaviour
> with different compilers. By its omission in the standard, I would think
> that it is allowed and has a C linkage (although some compilers don't
> agree, especially they mangle the name). Should it be included in the
> standard?

The standard has a number of rules that distinguish function types or
function names with "C" language linkage in a special fashion. To the
best of my knowledge, none of those rules involves "inline". I know of
no reason why a function couldn't have both features. Obviously, the
language linkage is only relevant for an inline function if an actual
function body is generated by the compiler.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: vishal_kochhar@hotmail.com (vishal)
Date: Tue, 8 Jun 2004 18:04:11 +0000 (UTC)
Raw View
Hi,

Is extern "C" inline allowed by the standard and if so would it have C
linkage if it were used out-of-line? I have seen different behaviour
with different compilers. By its omission in the standard, I would think
that it is allowed and has a C linkage (although some compilers don't
agree, especially they mangle the name). Should it be included in the
standard?


//allowed? does foo have C linkage?
extern "C" inline void foo()
{
}

extern "C"
{
     inline void foo() {}
}

Thanks,
Vishal

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]