[net.micro.amiga] A call for help with Manx C

fdfishman@watcgl.UUCP (Flynn D. Fishman) (05/09/86)

I am currently learning C and am having some difficulties, which I hope
someone in net land can solve.

When I compile several of the examples given in the Amiga manuals
using Aztec C68K 3.20a I get conversion warnings 
Following is the output from a compilation of one of these examples found
on page 2-3 of the Intuition manual Version 29.4
  (as far as we can tell we have typed the code in exactly as found in the
book except for the missing semicolon on the first structure)

 Sample Output:

	OpenLibrary("intuition.library",INTUITION_REV);
					               ^	
window.c:19: WARNING 121: ptr/int conversion:
        NewWindow.Title     = "A Simple Window";
						^
window.c:29: WARNING 124: invalid ptr/ptr assignment:
	iff(( Window = (struct Window *)OpenWindow(&NewWindow))==NULL)
             						              ^
window.c:44: WARNING 121: ptr/int conversion:


 I am running a 512k system and I Do my compilations from ram disk using
workbench 1.1.

   Thanks in advance
-- 

      FDFISHMAN (Flynn D. Fishman)

UUCP  :	...!{decvax|ihnp4|clyde|allegra|utzoo}!watmath!watcgl!fdfishman   
ARPA  :	fdfishman%watcgl%waterloo.csnet@csnet-relay.arpa 
CSNET :	fdfishman%watcgl@waterloo.csnet

higgin@cbmvax.cbm.UUCP (Paul Higginbottom) (05/12/86)

In article <670@watcgl.UUCP> fdfishman@watcgl.UUCP (Flynn D. Fishman) writes:
>When I compile several of the examples given in the Amiga manuals
>using Aztec C68K 3.20a I get conversion warnings 
> Sample Output:
>
>	OpenLibrary("intuition.library",INTUITION_REV);
>					               ^	
>window.c:19: WARNING 121: ptr/int conversion:
>        NewWindow.Title     = "A Simple Window";
>						^
>window.c:29: WARNING 124: invalid ptr/ptr assignment:
>	iff(( Window = (struct Window *)OpenWindow(&NewWindow))==NULL)
>             						              ^
>window.c:44: WARNING 121: ptr/int conversion:
>   Thanks in advance
>-- 
>
>      FDFISHMAN (Flynn D. Fishman)

<for the line eater>
Mr. Fishman:
	The examples in the Amiga manuals rarely 'extern' anything assuming
ints (32 bit) and pointers can be intermixed.  This is dandy if you compile
using the +l option on the Manx system, and ignore the warnings.
	Without the +l option, you'll have the compiler try to make pointers
from 16 bit quantities, and this will provide you with some unamusing
Guru numbers when you try to run the program.
	If external references had been declared as such, most of the casting
would be unnecessary, e.g:

	extern struct Window *OpenWindow();

	struct Window *W;
	
	if ((W = OpenWindow(ANewWindow)) == NULL) {
		etc.

The above fragment would not cause such warnings.

Source that doesn't declare routines as returning what they actually do has
caused grief for some people using the Manx system and subsequent grumbling
about said system on the nets.  I think this grumbling is unfair because the
Aztec system generates code that is usually 40% smaller than the same program
compiled under Lattice, and noticably faster.

	Paul Higginbottom.

Disclaimer: I do not work for Commodore, and my opinions are at least my own.