[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Clicc 0.6.4 in Codewarrior 5
- To: firstname.lastname@example.org (Karsten Poeck)
- Subject: Re: Clicc 0.6.4 in Codewarrior 5
- From: email@example.com (Doug Currie, Flavors Technology, Inc.)
- Date: Thu, 16 Feb 1995 10:34:33 -0500
- Cc: firstname.lastname@example.org
- Sender: email@example.com
>Second and more serious the compiled code only runs on a powerpc and not
>on a 68K Mac (it passes nearly all self tests in 68 mode, but the garbage
>collector does not work).
>Has anybody else tried Clicc 0.6.4 in Codewarrior 5? I would need some
>support since I am not very familiar with C programming on the Mac and the
>differences between an 68K and a PowerPc.
Here's a guess based on other ports of C code with CodeWarrior:
Unlike other C compilers, the CodeWarrior 68K compiler uses different
function return value protocols depending on the type of the value
returned. Specifically, when returning a pointer, the pointer is returned
in A0, otherwise the return value is returned in D0. Consequently, if the
caller and callee do not agree on the return type, the correct value will
not be returned.
The best policy is to require function prototypes, and never cast (the
returned value of) function calls.
The CodeWarrior PPC compiler does not use different function return value
protocols; this is the clue that it's the source of the problem.