Monday, May 7, 2012

BOOL’s Sharp Corners

Mark Dalrymple:

If g_name is non-nil, it’s a true value, so this function will be returning a true value. It might not be YES, but truth is truth in C, isn’t it? If this function returned bool, it would return the correct value.

Unfortunately, with BOOL, it doesn’t. If the address happens to have a zero lower byte, this function will return zero due to the same slicing behavior.

Comments RSS · Twitter

Leave a Comment