Path: utzoo!mnetor!uunet!husc6!bloom-beacon!tut.cis.ohio-state.edu!mailrus!nrl-cmf!ames!pasteur!ucbvax!CORY.BERKELEY.EDU!dillon From: dillon@CORY.BERKELEY.EDU (Matt Dillon) Newsgroups: comp.sys.amiga Subject: Re: 'void *' (was Re: malloc() prob. on 3.4a) Message-ID: <8804182308.AA21353@cory.Berkeley.EDU> Date: 18 Apr 88 23:08:32 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 31 :Matt Dillon writes: :> ... But what happens when you use AllocMem() to allocate :> a structure, then an array of something, then some other :> structure, etc....? void * gets to be *real* useful and makes :> code a lot easier to understand. : :That's when you use a cast. You can't simply pretend all pointers are :`void *'. It's just not right. And what happens when someone tries :to compile your code with a compiler that doesn't handle `void *'? Damn It! It's just not right! It makes little sense to declare AllocMem() as returning char * when you know it doesn't! Which is worse? Saying a function returns something it doesn't and using casts, or saying a function can return several (pointer) types ala void * and not use casts? What happens when someone tries to compile my code with a compiler that doesn't handle enumerations? What happens when someone tries to compile my code with a compiler that doesn't handle structure assignments? What happens when someone tries to compile my code with a compiler that doesn't handle structure return values? What happens when someone tries to compile my code with a compiler that doesn't understand what a signed char is? ... Get the point? -Matt