drand48()

jim frost madd at world.std.com
Fri May 17 07:52:06 AEST 1991


>>But I'm still wondering why the program worked on SUN without declearing
>>double drand48(), What is the difference between two compilers?
>>
>Actually, it fails on my SUN/4 without the declaration as well,
>so perhaps its a feature of a specific version of a Sun compiler.

Many RISC architectures do FP returns in FP registers and int returns
in int registers.  If you don't declare them you get the return from
the GPR rather than the FPR, which is bogus.

Many architectures have similar problems for func-returns-struct -- a
number of them pass the address for the return as a hidden argument.
If you don't properly declare your function, you goof up both incoming
and outgoing.

The '6000 uses both of these conventions as well as using registers as
arguments.  See info article on "Subroutine Linkage Convention".
Note, however, that FP arguments are *always* shadowed in GPRs
although the info document says otherwise.  One would assume that's
for compatibility with K&R-style varargs functions.

Happy hacking,

jim



More information about the Comp.unix.aix mailing list