Date: Wed, 10 Jan 1996 19:01:02 -0500 (EST) From: Cuthalion / Sliced Bread To: kagel AT quasar DOT bloomberg DOT com cc: dunder AT nyongwa DOT montreal DOT qc DOT ca, djgpp AT delorie DOT com Subject: Re: (none) Message-ID: MIME-Version: 1.0 On Wed, 10 Jan 1996 kagel AT quasar DOT bloomberg DOT com wrote: > if (!my_pointer) > my_pointer = (my_struct_t *)malloc( sizeof (my_struct_t) ); > > Or BETTER CODE but equivalent: > > if (my_pointer == (my_struct_t *)NULL) > ... You shouldn't need to cast NULL, I don't think... Either way, even better than that would be: if (NULL == my_pointer) ... since this will give you a compiler error if you make a typo and only use one equal sign. (Otherwise, it is an assignment, which can cause no end of problems. It's also a PAIN to find, when you do do it.) /*********************************************************************** * Jesse Morris * cuth AT gryphon DOT ccs DOT brandeis DOT edu * jrmorris AT macalstr DOT edu * **************** Cuthalion / Sliced Bread ************************* \*********************************/