www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/19/03:45:32

Message-ID: <35DA7FE6.FF47DA28@geocities.com>
From: Merlin <merlin__ AT geocities DOT com>
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: A very basic question about C programming... diary of a newbie Part 1
References: <Pine DOT SUN DOT 3 DOT 91 DOT 980812131004 DOT 17366A-100000 AT is> <35D2A017 DOT 4808178C AT geocities DOT com> <35d30896 DOT 834512 AT news DOT Austria DOT EU DOT net> <35D3BC2B DOT 5F92B357 AT geocities DOT com> <35d3ef05 DOT 75223464 AT news DOT snafu DOT de> <35D664E8 DOT EB0CEA0C AT geocities DOT com> <35d8a9fe DOT 9175287 AT news DOT Austria DOT EU DOT net> <35D7CDA3 DOT 2138B40B AT geocities DOT com> <35d92222 DOT 866292 AT news DOT Austria DOT EU DOT net> <35D935FA DOT BB5E1E88 AT geocities DOT com> <35da4eed DOT 10011000 AT news DOT rapidnet DOT net>
Lines: 33
Date: Wed, 19 Aug 1998 07:37:39 GMT
NNTP-Posting-Host: 198-cy-wpg.ilos.net
NNTP-Posting-Date: Wed, 19 Aug 1998 02:37:39 CDT
Organization: MBnet Networking Inc.
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019