This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On 01/11/2013 10:29 AM, Roland McGrath wrote:
> It's OK with me though I'm not sure why you are motivated to remove it.
> assert is normally used exactly for things verifying internal assumptions.

This is probably as good a time as any to have a quick discussion
about asserts.

I can agree that asserts are good for complicated things like page
size assumptions, or alignments determined elsewhere in the code that 
initializes the static TLS data. It's hard to coordinate those two
pieces of data so you use an assert to ensure that your expectations
still match.

Yet for simple things like input arguments to a function that is
on the hot path of all pthread_create calls, is it really necessary?
One caller to a function that was refactored because of size has a
well known and controlled set of input arguments.

Does that make sense?

Cheers,
Carlos.
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]