use of NULL
    mcdonald at uxe.cso.uiuc.edu 
    mcdonald at uxe.cso.uiuc.edu
       
    Fri Feb 24 02:06:00 AEST 1989
    
    
  
Subject is the flame wars resulting from the never-ending NULL
(presumable pointer) affairs.
Chris Torek claims (correctly) that if one wishes to pass a null
pointer to a subroutine, that if you cast it to the proper type,
it will work:
      sub((char *)0); /* pass a character pointer*/
     subd((double *)0); /* pass a pointer to double */
I ask: Is it not possible to do away with this if one uses 
functions prototypes? Is this correct (I mean, ABSOLUTELY correct?)
void sub(char *);
void subd(double *);
sub(0);
subd(0);
void sub(char * xchar)
{ ... }
void sub(double *ddouble)
{ ... }
I ask this as a question, not as a proposition of a flame.
I have written a lot of programs for mixed (VERY mixed) model programs
on the PC, and used strict prototypes for all. They seem to work 
fine. I never cast anything in arguments, unless it is a signed to
unsigned (or vice-versa) conversion, and in that case I am paranoid
enough to write out each step explicitly. Am I doing a no-no?
Doug McDonald
    
    
More information about the Comp.lang.c
mailing list