[Ffmpeg-devel] stdint.h and inttypes.h for non-C99 compilers

Måns Rullgård mru
Fri Dec 15 13:50:43 CET 2006


Christian Iversen said:
> On 15. December 2006 04:02, M?ns Rullg?rd wrote:
>> Christian Iversen <chrivers at iversen-net.dk> writes:
>> > On Wednesday 13 December 2006 12:56, M?ns Rullg?rd wrote:
>> >> Alexander Chemeris said:
>> >> > Why do you change this?
>> >> > Is __cdecl is not enough?
>> >>
>> >> You're both wrong.  The __cdecl modifier tells the compiler to use the
>> >> standard C calling convention (the alternative being __stdcall for
>> >> Pascal calling convention).
>> >
>> > Just FYI, __stdcall is usually _not_ used in pascal. The calling
>> > conventions that sane pascal compilers call "pascal" is a
>> > register-based convention, that is much more efficient. The
>> > corresponding pascal function attribute is "stdcall;"
>>
>> How do these Pascal compilers pass more arguments than will fit in
>> registers?  Who is responsible for restoring the stack, caller or
>> callee?
>
> Extra arguments are passed on the stack as with stdcall, but since this
> removed up to 3 arguments from the stack, it's a much better convention. (we
> are talking x86 here, of course)

Passing arguments in registers is usually good idea, of course.

> The stack is callee-cleared, and thus "register" is very much like (perhaps
> identical to) Borland C++'s "__fastcall" modifier:

Requiring the callee to restore the stack is simply stupid, IMHO.  Imagine
what would happen if a function like printf were called with too many arguments.

-- 
M?ns Rullg?rd
mru at inprovide.com




More information about the ffmpeg-devel mailing list