Re: C/C++ calling convention
On Aug 24, 10:14 pm, Ian Collins <ian-n...@hotmail.com> wrote:
On 08/25/10 08:56 AM, Stanis=C5=82aw Findeisen wrote:
Given an architecture and a language (C or C++), is there
any standard function calling convention? Or is it compiler
dependent?
The two languages are different. With C, there will be
a platform standard, with C++ it is still (regrettably)
compiler specific.
Maybe. Formally, the situation is the same for both languages;
the language standard doesn't address this issue, it is up to
the platforms. Practically, there are very few platforms which
don't have a standard function calling convention for C, and not
too many which have one for C++ (but I think Linux has one, and
Itanium based machines).
In practice, when writing C++, just having common calling
conventions isn't enough. You need compatible implementations
of the STL as well. And on many implementations (g++, VC++),
the actual implementation of the STL changes depending on
compiler options, and even compiling all of the code with the
same compiler is no guarantee---you have to be sure that all of
the significant options were the same as well.
--
James Kanze