Mail Archives: djgpp/1998/08/19/03:45:32
richard AT stardate DOT bc DOT ca wrote:
> >> I don't know if DJGPP supports pascal style calling, but in C the arguments
> >> are pushed on the stack and taken from the stack by the caller. In pascal the
> >> arguments are pushed on the stack by the caller and removed from the stack by
> >> the callee. This means that, if you pass the wrong number of parameters (to
> >> much) to a C function, then nothing happens (if you pass to less then you
> >> might get problems). If you pass to much arguments to a pascal function then
> >> the stack is damaged. This is only of interest if you have to interface to
> >> pascal functions (i.e in windows programming this is needed).
> >
> >ahhh...so in the end all this could cause a stack overflow..that is assuming it doesn't stop
> >when you screw the stack up...
> >
>
> AFAIK the PASCAL v C calling convention determins the order that the
> variables a pushed onto the stack (left to right v right to left), I
> think that PASCAL is right to left but there is a 50% chance I am
> wrong.
>
> AFAIK the callee does not pop the variables off the stack but uses
> them where they are situated using the stack pointer as a base address
> to work from.
hmmm..maybe i'll have to look into this..
.
maybe not...it just doesn't seem very important...as long as i make no mistakes in my code i
shouldn't have to know what the difference is...but i will probably check it out anyway....
thanks..
Merlin.
- Raw text -