[comp.sys.amiga.tech] Return values of System Functions

dillon@CORY.BERKELEY.EDU.UUCP (04/03/88)

:	The reason for my question:  I am using Manx 3.6a, and have this file
:called "functions.h".  Oh, you've heard of it?  It says that many functions
:return "short"s, and other non-long types, which contradicts the file
:"manx.c" (which I am using to lint my programs with).  I looked through
:the library sources, but they don't tell me what kind of values the functions
:return (I can't see how they could be anything but "long", but want to check).
:The autodocs are on order (will those help me with this)?  By the way, I

	Since an integer return value is in D0, the callee can treat it 
either as a long or short.  Thus, even if the entire D0 register is used,
if the actual range of the return value is within the limits of a short,
you can declare the function as returning a short.

	Essentially, Aztec's functions.h file is declaring some functions
as returning a short as an optimization technique for those people who use
+L (32 bit ints).  The functions need to be compilable under either model.

	I never use lint.

						-Matt

scott@applix.UUCP (Scott Evernden) (04/05/88)

In article <8804030250.AA23769@cory.Berkeley.EDU> dillon@CORY.BERKELEY.EDU (Matt Dillon) writes:
>	Since an integer return value is in D0, the callee can treat it 
>either as a long or short.  Thus, even if the entire D0 register is used,
>if the actual range of the return value is within the limits of a short,
>you can declare the function as returning a short.

Except when it returns a USHORT.  Some Intuition functions do, or at
least I think they do.  I used to think all functions returned longs
until I got badly burned dealing with this in the recent past.

-scott