Xref: utzoo comp.lang.c:30610 comp.os.msdos.programmer:278 alt.msdos.programmer:1979 Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!mcsun!unido!fauern!lan!rommel From: rommel@lan.informatik.tu-muenchen.dbp.de (Kai-Uwe Rommel) Newsgroups: comp.lang.c,comp.os.msdos.programmer,alt.msdos.programmer Subject: Re: Suspicious pointer conversion warning in Turbo C 2.0 Message-ID: <3629@tuminfo1.lan.informatik.tu-muenchen.dbp.de> Date: 27 Jul 90 11:09:52 GMT References: <1990Jul25.230836.2442@Octopus.COM> Sender: news@lan.informatik.tu-muenchen.dbp.de Reply-To: rommel@lan.informatik.tu-muenchen.dbp.de (Kai-Uwe Rommel) Followup-To: comp.lang.c Organization: Inst. fuer Informatik, TU Muenchen, W. Germany Lines: 35 In article <1990Jul25.230836.2442@Octopus.COM> stever@octopus.COM (Steve Resnick ) writes: > As far as I know, when I provide a prototype for a function which accepts > a void pointer, the compiler should not bitch about type conversions between > pointers. The code fragment below generates a warning message when I pass a > pointer to a structure. The parameter bitched about is the second pointer. >void AddLNode(void ** Hptr, void * Nptr); >void * DelLNode(void ** , void * ); > Tlist *Head, *Walker; > AddLNode(&Head,Walker); /* This statement generates a warning */ > DelLNode(&Head,Walker); /* This statement generates a As you said, you can pass any pointer to a function declared with a pointer to void as an argument. But you did not declare such a function. "void *" and "void **" is not the same! The first is a pointer to void but the second is a pointer to a pointer variable. You should declare: >void AddLNode(void * Hptr, void * Nptr); >void * DelLNode(void * , void * ); Although you probably mean something what is called "call by reference" you shoud declare it this way to avoid the warning. This declaration does not prevent you to do the same in the AddLNode, DelLNode functions. You will have to cast the arguments in these function to what you want anyway. Kai Uwe Rommel -- /* Kai Uwe Rommel * Munich * rommel@lan.informatik.tu-muenchen.dbp.de */