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

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: sparky!uunet!mcsun!Germany.EU.net!mpifr-bonn.mpg.de!specklec.mpifr-bonn.mpg.de!mlelstv
  3. From: mlelstv@specklec.mpifr-bonn.mpg.de (Michael van Elst)
  4. Subject: Re: Hey Commodore types
  5. Message-ID: <1992Jul23.103350.14923@mpifr-bonn.mpg.de>
  6. Sender: news@mpifr-bonn.mpg.de
  7. Nntp-Posting-Host: specklec
  8. Organization: Max-Planck-Institut f"ur Radioastronomie
  9. References: <paulk.0k1w@terapin.com> <1992Jul14.014115.6212@agora.uucp> <1992Jul14.182841.5792@ultb.isc.rit.edu> <1992Jul15.023355.1552@agora.uucp> <1992Jul15.114615.25849@mpifr-bonn.mpg.de> <1992Jul22.151307.1736@sagpd1>
  10. Date: Thu, 23 Jul 1992 10:33:50 GMT
  11. Lines: 36
  12.  
  13. In <1992Jul22.151307.1736@sagpd1> monty@sagpd1 () writes:
  14. >    I am confused???? You are saying that a function expects a UBYTE so the
  15. >    complier passes an unsigned long???????? and this is correct ?????
  16.  
  17. >    What am I overlooking here, do all amiga compliers always pass longs
  18. >    on the stack???
  19.  
  20. All system calls do not expect anything on the stack but data gets passed
  21. in processor registers which are 32bit.
  22.  
  23. The autodocs tell you that some of the register values are considered
  24. as UBYTE,UWORD, PLANEPTR or whatever.
  25.  
  26. The compiler, however generates calls to some stub functions in amiga.lib
  27. which will pull complete 32bit values from the stack into the correct
  28. registers and call the system routine.
  29.  
  30. Under K&R C every integer parameter was pushed as a LONG onto the stack
  31. anyway. Same for ANSI C if you don't use prototypes. This matches the
  32. behaviour of the stub routines.
  33.  
  34. With prototypes however you could end with the compiler pushing words
  35. or even bytes if the prototype would specify UWORD or UBYTE which is
  36. of course _not_ what the stub routines await.
  37.  
  38. If one uses inline library calls with some #pragma construct one could
  39. argue that the prototypes _can_ specify other types then long (or pointers
  40. which are also 32bit). But I think that would just lead to confusion
  41. with uses of amiga.lib.
  42.  
  43. Regards,
  44. -- 
  45. Michael van Elst
  46. UUCP:     universe!local-cluster!milky-way!sol!earth!uunet!unido!mpirbn!p554mve
  47. Internet: p554mve@mpirbn.mpifr-bonn.mpg.de
  48.                                 "A potential Snark may lurk in every tree."
  49.