On Tue, Oct 4, 2011 at 5:46 AM, Pedro Alves <pe...@codesourcery.com> wrote:
> On Tuesday 04 October 2011 11:16:30, Gabriel Dos Reis wrote:
>
>> > Do we need to consider ABIs that have calling conventions that
>> > treat unprototyped and varargs functions differently? (is there any?)
>>
>> Could you elaborate on the equivalence of these declarations?
>
> I expected that with:
>
>  extern void foo();
>  extern void bar(...);
>  foo (1, 2, 0.3f, NULL, 5);
>  bar (1, 2, 0.3f, NULL, 5);
>
> the compiler would emit the same for both of those
> calls (calling convention wise).  That is, for example,
> on x86-64, %rax is set to 1 (number of floating point
> parameters passed to the function in SSE registers) in
> both cases.

Except that variadics use a different kind of calling convention
than the rest.

>
> But not to be equivalent at the source level, that is:
>
>  extern void foo();
>  extern void foo(int a);
>  extern void bar(...);
>  extern void bar(int a);
>
> should be a "conflicting types for ’bar’" error in C.
>
> --
> Pedro Alves
>

Reply via email to