Garrett D'Amore writes:
> On Fri, 2007-08-24 at 08:13 -0400, James Carlson wrote:
> > Thus, the ASSERT here adds no real value and shouldn't appear.
> 
> Ah, but the ASSERT here indicates that the author *knew* that he wasn't
> checking for NULL, because it can't be.  So it serves as a kind of
> design statement.  I think it is reasonable here.  If it were removed,
> then it should be replaced with a comment to the same effect...

To me, the intentional dereference makes the same statement, but if
someone wanted to add a comment saying "I know ipst cannot be a bad
pointer because <insert-reason-here>," I certainly wouldn't complain.

The assert just says that it can't (by design) be NULL.  It doesn't
say it's a good pointer (no assert can say that really), nor does it
really document the rationale (e.g., "this thread holds a reference").
Those are the key things for safety -- not just the single special
value of NULL.

-- 
James Carlson, Solaris Networking              <[EMAIL PROTECTED]>
Sun Microsystems / 1 Network Drive         71.232W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.496N   Fax +1 781 442 1677
_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to