[ProgClub list] Memory management in C

John Elliot jj5 at progclub.org
Sun Oct 2 05:28:21 AEDT 2011


On 2/10/2011 5:09 AM, Asher Glynn wrote:
> It depends on the language - if you have a high level one, forget it, you
> are doing whatever it says. In C and Pascal you modify it through compiler
> directives. Say in Windows, every API has a PASCAL macro telling it to pass
> according to the Pascal calling convention, you include the header file and
> it tells the compiler what to do. In Pascal I can't remember exactly what it
> was.

You'd think I'd find something useful, but no:

http://www.google.com.au/search?q=passing+a+parameter+via+a+register+in+C

http://www.google.com.au/search?q=how+to+pass+a+parameter+in+a+register+in+C

It seems to me like the calling convention is completely out of the 
developer's hands.

I found this:

http://msdn.microsoft.com/en-us/library/zthk2dkh.aspx

Which I don't entirely understand. It seems to be saying that the first 
four parameters are passed in particular registers (depending on their 
size and type). Does this mean 'always'? Do all compilers have to know 
about this and generate code accordingly?

Maybe this will help:

http://www.google.com.au/search?q=embedding+assembly+in+C

Reading now...



More information about the list mailing list