More NULL questions

Joe Gilray jg at hpldola.HP.COM
Fri Oct 6 07:37:41 AEST 1989


Recently I've seen some discussion on the use of NULL, there was
a lot of discussion but I still feel that I need the answers to the
following questions:

1) what is the danger with using
         struct thing *ptr;
         .
         .
         .
         if (ptr != NULL) ...
   as apposed to
         struct thing *ptr;
         .
         .
         .
         if (ptr != (struct thing *)NULL) ...
   ?

2) Is there danger using
         int a, b;
         .
         .
         .
         my_func(a, NULL, b);
   as apposed to
         int a, b;
         .
         .
         .
         my_func(a, (struct thing *)NULL, b);
   when
   a) you are using function prototypes?
   b) you are NOT using function prototypes (like me)?

Thanks for any help.

-Joe Gilray



More information about the Comp.lang.c mailing list