home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: sparky!uunet!elroy.jpl.nasa.gov!decwrl!pa.dec.com!ninja!zowie.zso.dec.com!ridder
- From: Hans Ridder <ridder@zso.dec.com>
- Subject: Re: Hey Commodore types
- Message-ID: <1992Jul23.002734.25688@ninja.zso.dec.com>
- Originator: ridder@zowie.zso.dec.com
- Sender: news@ninja.zso.dec.com (USENET News System)
- Nntp-Posting-Host: zowie.zso.dec.com
- Organization: Digital Equipment Corporation - DECwest Engineering
- References: <1992Jul15.023355.1552@agora.uucp> <1992Jul15.114615.25849@mpifr-bonn.mpg.de> <1992Jul22.151307.1736@sagpd1>
- Date: Thu, 23 Jul 1992 00:27:34 GMT
- Lines: 45
-
- In article <1992Jul22.151307.1736@sagpd1> monty@sagpd1.UUCP (Monty Saine) writes:
- >In article <1992Jul15.114615.25849@mpifr-bonn.mpg.de> mlelstv@specklec.mpifr-bonn.mpg.de (Michael van Elst) writes:
- >>
- >>The autodocs specify the values the function expects/returns, the
- >>prototypes specify what the C-code has to pass to the function.
- >
- > I am confused???? You are saying that a function expects a UBYTE
- > so the complier passes an unsigned long???????? and this is
- > correct ?????
- >
- > What am I overlooking here, do all amiga compliers always pass
- > longs on the stack???
-
- OK, read carefully. All Amiga ".library" functions take parameters in
- *registers*, not on the stack. Those parameters are *always* longs.
- See any release of the RKM's.
-
- Although the function may (currently) only look at, for example, the low
- order byte, you should make sure that the high order bits are set
- appropriately (sign extended for signed parameters, zero for unsigned.)
-
- > This is not a flame, I am truely confused by how both can be
- > 'correct' in the above examples.
-
- No problem. Just think about what would happen if your program calls a
- library function which (currently) takes a UWORD for say, a "screen
- width." A newer release of the library comes out which allows screens
- that can be wider than a UWORD can hold. If you (or the compiler)
- didn't make sure that the high order word in the register were zero (in
- this case,) then your program could crash/bomb/die due to any "garbage"
- bits in upper part of that register. It's a future compatibility thing.
-
- > Monty Saine
-
- Does that help?
-
- (Note that I don't think C= could ever change any of the parameter sizes
- because of all that assembly code out there which isn't carefull about
- the high bits. Oh well.)
-
- -hans
- --
- Hans-Gabriel Ridder Digital DECwest Engineering
- ridder@rust.zso.dec.com Bellevue, Washington, USA
- {pacbell,pyramid,uunet}!rust.zso.dec.com!ridder
-