home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / amiga / programm / 11511 < prev    next >
Encoding:
Text File  |  1992-07-22  |  2.5 KB  |  59 lines

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