Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/distrib/utils/sysinst



On Mon, 21 Jul 2003, David Laight wrote:
> > David Laight <dsl%netbsd.org@localhost> writes:
> > > Change a lot of 'if (strlen(x) == 0)' to 'if (x[0] === 0)'.
> >
> > Why bother? Was this performance critical code? The former is clearer
> > to the reader.
>
> IMHO the latter is clearer, the test is 'is this string null' not
> 'does it have zero length'.  I'll often write 'if (!*x)' to save keystrokes!

FWIW, i find the strlen(x)==0 thing most readable.


 - Hubert

-- 
Want to get a clue on IPv6 but don't know where to start? Try this:
* Basics -> http://www.onlamp.com/pub/a/onlamp/2001/05/24/ipv6_tutorial.html
* Setup  -> http://www.onlamp.com/pub/a/onlamp/2001/06/01/ipv6_tutorial.html
Of course with your #1 IPv6 ready operating system -> http://www.NetBSD.org/



Home | Main Index | Thread Index | Old Index