Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bbn!oberon!pollux.usc.edu!papa From: papa@pollux.usc.edu (Marco Papa) Newsgroups: comp.sys.amiga.tech Subject: Re: New RKM:AutoDocs & Includes MAJOR problem! Message-ID: <15751@oberon.USC.EDU> Date: 10 Mar 89 03:04:36 GMT References: <1467@percival.UUCP> <6195@cbmvax.UUCP> Sender: news@oberon.USC.EDU Reply-To: papa@pollux.usc.edu (Marco Papa) Organization: Felsina Software, Los Angeles, CA Lines: 44 In article <6195@cbmvax.UUCP| daveh@cbmvax.UUCP (Dave Haynie) writes: |in article <1467@percival.UUCP|, baer@percival.UUCP (Ken Baer) says: || Keywords: RKM, parameter type, Manx, WARNING Will Robinson! | || HOWEVER, to my dismay, I discovered that the type sizes are WRONG! Those || of us who use Manx C, know that when you pass an integer to an Amiga system || function (like Draw()), you have to cast it to LONG (or it must be LONG in || the first place). But, in the new RKM, these variables are listed as || SHORT!! Not as LONG! I guarentee that if you call Draw(rp, (SHORT)x, || (SHORT)y) you'll either go somewhere wierd, or crash horribly. | |Here we have another case of "something's wrong, it must be Commodore who |screwed up!". Possibly not. I would expect the RKM/Autodocs to reflect |the parameter size that the routine is actually expecting. Of course, as |we all know, those routines pass parameters in registers, and regardless |of how the underlying routine uses it, the register contents at the point |of function call is 32 bits wide. I suspect that the point of confusion |here is in the Manx bindings to the ROM routines. Each high level language |has to work out just how it's going to call a function. C has to provide |bindings for each function which supply C visable function names and turn |C style stack parameters into the registers a particular routine requires. Actually things are not as bad as they look, simply because every implementation of the 'C' langage has to respect the following rule, excerpted from page 186 of K&R: "Any actual argument of type float are converted to double before the call; any of type char or short are converted to int;" ^^^^^ ^^^ I myself have been using the Draw(rp, x, y) function with x and y declared either as SHORT or as LONG with no apparent problem [my programs were compiled with +L so that SHORT and LONG have different size]. -- Marco Papa 'Doc' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= uucp:...!pollux!papa BIX:papa ARPAnet:pollux!papa@oberon.usc.edu "There's Alpha, Beta, Gamma and Diga!" -- Leo Schwab [quoting Rick Unland] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=