Path: utzoo!attcan!uunet!ateng!chip From: chip@ateng.ateng.com (Chip Salzenberg) Newsgroups: comp.lang.c Subject: Re: Variadic functions Message-ID: <1988Nov12.165027.2756@ateng.ateng.com> Date: 12 Nov 88 21:50:26 GMT References: <434@tutor.UUCP> <225800083@uxe.cso.uiuc.edu> <2774@ingr.UUCP> Organization: A T Engineering, Tampa, FL Lines: 26 WARNING -- NULL ALERT. If you understand NULL pointers, skip this article. According to crossgl@ingr.UUCP (Gordon Cross): > Wouldn't it be much nicer to be able to call the > function with the single line > > yourfunction ("arg1", "arg2", ... , 0); Correct ways to code this function call would be: yourfunction ("arg1", "arg2", ... , (char *) 0); or yourfunction ("arg1", "arg2", ... , (char *) NULL); The reason? Neither uncasted 0 nor uncasted NULL [1] is acceptable as an actual function parameter of any pointer type. (Except in the presence of a function prototype, of course; but this is a variadic function we're discussing, so prototypes are almost irrelevant.) [1] According to K&R and the dpANS, "#define NULL 0" is permitted. -- Chip Salzenberg or A T Engineering Me? Speak for my company? Surely you jest! Beware of programmers carrying screwdrivers.