Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!pasteur!ucbvax!CORY.BERKELEY.EDU!dillon From: dillon@CORY.BERKELEY.EDU (Matt Dillon) Newsgroups: comp.sys.amiga Subject: Re: malloc() prob. on 3.4a Message-ID: <8804132311.AA05719@cory.Berkeley.EDU> Date: 13 Apr 88 23:11:33 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 29 >main() >{ > struct def *head; > > head = (struct def *) malloc(sizeof(struct def)); > >Any help on how to get rid of this warning, would help. Because you ARE casting from an int to a pointer... you need to declare malloc as returning a pointer: extern char *malloc(); Or, if you don't want to bother with a cast, you can: extern void *malloc(); Leo has kind of set a convention of making a lot of intuition funcs() return void --> void *OpenScreen(). Then in the code he has: s=OpenScreen(&sdef); He might have a cast. Anyways, why would you do this? The compilier should issue an error, you can't return values from a void func()? I understand it has to do with 16 bit ints and what not. Comments? He's returning a 'void *' ... not a void, but a pointer to a void. That's an ANSI standard, I believe, meaning "pointer to anything". It's useful for things like AllocMem() and malloc(), but Leo's just being lazy if he's using it for OpenScreen(). -Matt