Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "\pPascal strings again"



On 30/11/2005 01:06 Am, alex wrote:
> At 12:23 PM -0900 11/30/05, Mike Kluev wrote:
>> On Wed, 30 Nov 2005 10:58:03, Chris Hanson <email@hidden> wrote:
>> 
>>> On Nov 29, 2005, at 2:10 PM, Chris Espinosa wrote:
>>> 
>>>> The 'pascal' keyword actually became a no-op in the transition to
>>>> PowerPC more than ten years ago.  It specified whether arguments
>>>> should be pushed on the calling stack in left-to-right or right-to-
>>>> left order.  Because PowerPC passes function arguments in
>>>> registers,  'pascal' is meaningless in the PowerPC ABI.
>>> 
>>> With enough function arguments ? or the right combination of types of
>>> function arguments, if I remember correctly ? PowerPC still requires
>>> arguments to be pushed onto the stack.  However, the PowerPC ABI
>>> declared that all arguments must be pushed in left-to-right order for
>>> interop purposes, keeping the "pascal" keyword meaningless.
>> 
>> left-to-right? Is that not a problem for var-arg functions?
>
> Also I remember that pascal expects the caller to cleanup to the stack whereas
> in C the callee cleans up the stack. (perhaps I have this reversed)...

Yep, the reverse is true. It is easy to remember: this is C who has
var-arg functions and the callee can't clean up the stack for those
because it doesn't know how many of those.

> There was also something about whether or not to return values on the stack
> but I believe that too is covered in the PowerPC ABI.  I assume the stack
> cleanup issues are also addressed (namely by simply using registers instead of
> the stack)?

Even when all params fit in registers, the PPC ABI reserves space for
them on the stack (however insane this sounds).

> Other the years the whole going from Pascal to C on a 68k and then going from
> 68k to PPC and now to Intel has really 'done a number' on my facilities to
> find useful information in my brain at a reasonable speed.   I doubt that it's
> solely the Mac's fault ;-)

Mike

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: "\pPascal strings again" (From: alex <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.