Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!utcsri!flaps From: flaps@utcsri.UUCP Newsgroups: comp.lang.c Subject: Re: pointer debate raging on... (LONG) Message-ID: <4801@utcsri.UUCP> Date: Thu, 21-May-87 00:40:12 EDT Article-I.D.: utcsri.4801 Posted: Thu May 21 00:40:12 1987 Date-Received: Fri, 22-May-87 00:37:31 EDT References: <149@sds.UUCP> Reply-To: flaps@utcsri.UUCP (Alan J Rosenthal) Organization: University of Toronto Lines: 29 Summary: In article <149@sds.UUCP> dave@sds.UUCP (dave schmidt x194) writes: >A minor problem still exists even with defining NULL as (void *)0; >NULL cannot be passed to a routine as function pointer without >a cast since sizeof(void (*)()) may not be the same as sizeof(void *). I think Dave Schmidt fails to realize that sizeof(char *) might not be the same as sizeof(int *) or sizeof(void *). Truly the only solution when passing NULL as a parameter is to cast it to the correct pointer type. Furthermore, other parameters should be cast to (char *) when being passed to routines expecting (char *), as in: struct somethinghuge a,b; memcpy((char *)&a,(char *)&b); in case (char *) is not a no-op, as it isn't on machines that number their words (as opposed to bytes) consecutively which therefore use some bits of a char * to say where in the word the char is. -- // Alan J Rosenthal // \\ // flaps@csri.toronto.edu, {seismo!utai or utzoo}!utcsri!flaps, \// flaps@toronto on csnet, flaps at utorgpu on bitnet. Kermit - Protocol error