[PATCH] Remove `attr != NULL' assert in allocate_stack.

Roland McGrath roland@hack.frob.com
Fri Jan 11 19:12:00 GMT 2013


The purpose of asserts is partly documentation, which can also be served by
comments but asserts are self-testing against bit-rot as comments cannot
be.  The main purpose is to ensure that intended assumptions of the code
are not accidentally violated by changes elsewhere, which is a common
source of subtle bugs.  Even if the caller and callee seem intimately tied
now, they might not seem so obviously so to someone else touching the code
months or years from now.

In the particular case of an assumption that a pointer is not null, just
the fact that the code (unconditionally) uses the pointer is sufficient as
an assert (though not necessarily as documentation), since it will reliably
and straightforwardly crash.


Thanks,
Roland



More information about the Libc-alpha mailing list