Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site rlgvax.UUCP Path: utzoo!watmath!clyde!bonnie!akgua!sdcsvax!dcdwest!ittvax!decvax!genrad!panda!talcott!harvard!seismo!rlgvax!guy From: guy@rlgvax.UUCP (Guy Harris) Newsgroups: net.lang.c Subject: Re: runtime 'sizeof()'? Message-ID: <462@rlgvax.UUCP> Date: Mon, 11-Feb-85 00:47:22 EST Article-I.D.: rlgvax.462 Posted: Mon Feb 11 00:47:22 1985 Date-Received: Thu, 14-Feb-85 00:56:10 EST References: <33@gitpyr.UUCP> <800002@acf4.UUCP> <584@ncoast.UUCP> Organization: CCI Office Systems Group, Reston, VA Lines: 20 > #define Null(type) ((type *) 0) > > ... > if ((fp = fopen(filename, "r")) == Null(FILE)) > ... > > You get the idea. Easy to use and it makes the point (pun not intended) > evident. Although it isn't necessary; the compiler knows that the LHS of the "==" is a "FILE *" so it can coerce the "0" to a null FILE *. In ANSI Standard C it can even be told that the Nth argument to a function is a FILE * and will coerce 0 there; the only place this doesn't work is in functions which take a variable number of arguments. The main "offender" here is "execl", which is just a bit of syntactic sugar - anything you can do with "execl" you can do with "execv" at the expense of having to build an argument vector somewhere else. Guy Harris {seismo,ihnp4,allegra}!rlgvax!guy