[Asterisk-Dev] FW: asterisk/doc CODING-GUIDELINES,1.4,1.5
Edwin Groothuis
edwin at mavetju.org
Tue Jan 18 22:00:10 MST 2005
On Tue, Jan 18, 2005 at 05:42:34PM -0700, Kevin P. Fleming wrote:
> Finally, it's silly to use strlen at all here for the first check,
> that's why we have ast_strlen_zero, which checks only the first
> character of the string to see whether it's null or not... however, that
> depends on how often the string being checked here will be non-empty; if
> it will be empty a great deal of the time, ast_strlen_zero will be a big
> CPU time savings. If on the other hand it will be non-empty most of the
> time, calling strlen will be OK, since we need that value anyway.
Any C programmer who checks with strlen() if the length of a string
is greater than zero should be forced to read the K&R book again
to understand how the C programming language actually works.
Edwin
--
Edwin Groothuis | Personal website: http://www.mavetju.org
edwin at mavetju.org | Weblog: http://weblog.barnet.com.au/edwin/
More information about the asterisk-dev
mailing list