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

Christian Iversen chrivers
Sat Dec 16 02:21:13 CET 2006


On Friday 15 December 2006 13:50, M?ns Rullg?rd wrote:
> Christian Iversen said:
> > On 15. December 2006 04:02, M?ns Rullg?rd wrote:
> >> 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.

Agreed.

> > 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.

Well, that depends on the circumstance. 

> Imagine what would happen if a function like printf were called with too
> many arguments.

What do you mean by "too many"?

Pascal calling convention is not used with the same style of varargs as cdecl, 
so the function will always know how many parameters it has accepted. This is 
never a problem in practice.

Of course, calling conventions on x86 is a mess anyway. Now, the x86_64 
calling convention, that's something sane :-)

-- 
Regards,
Christian Iversen




More information about the ffmpeg-devel mailing list