Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!purdue!decwrl!labrea!polya!ali From: ali@polya.Stanford.EDU (Ali T. Ozer) Newsgroups: comp.sys.amiga Subject: Re: what's wrong with this picture? Message-ID: <8730@polya.Stanford.EDU> Date: 24 Apr 89 18:44:21 GMT References: <13853@louie.udel.EDU> Sender: Ali T. Ozer Reply-To: aozer@NeXT.com (Ali Ozer) Organization: . Lines: 26 In article <13853@louie.udel.EDU> Lois Mermelstein writes: >Ok, I give up. Why does the following (example code for a doubly-linked- >list) give the compiler warning "pointer/int conversion"? > >head = (struct aet *) malloc(sizeof(struct aet)); Assuming you haven't declared malloc() explicitly anywhere, or included a header file that declares it, Manx assumes it returns an int (like any C compiler should). Thus coercion to a pointer generates the warning. Now, here's the bad news... Judging from your posting, you are using 16 bit ints, not 32. Thus Manx assumes malloc() returns a 16 bit entity which needs to be converted into a 32 bit one. Thus your pointer ends up losing the top 16 bits; you get an illegal pointer. Probably the reason for the guru. The solution is to include the following in your program: extern void *malloc(); And then do the coercion like you were. You will not get any warnings, and the program will not guru (in both 16 or 32 bit modes). Manx 5.0 will be ANSI, I hope... Ali Ozer aozer@NeXT.com