Date: 05 Apr 2002 10:19:19 -0800 From: John Merryweather Cooper <john_m_cooper@yahoo.com> To: obrien@freebsd.org Cc: Mikhail Teterin <mi@aldan.algebra.com>, mike@freebsd.org, cvs-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/usr.bin/yacc main.c Message-ID: <1018030764.4511.22.camel@johncoop.MSHOME> In-Reply-To: <20020405100427.A46969@dragon.nuxi.com> References: <20020405003033.F93859@espresso.q9media.com> <200204051656.g35GuUnF010963@aldan.algebra.com> <20020405100427.A46969@dragon.nuxi.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 2002-04-05 at 10:04, David O'Brien wrote: > On Fri, Apr 05, 2002 at 11:56:30AM -0500, Mikhail Teterin wrote: > > On 5 Apr, Mike Barcroft wrote: > > > David O'Brien <obrien@FreeBSD.org> writes: > > >> On Thu, Apr 04, 2002 at 07:17:57PM -0500, Mikhail Teterin wrote: > > >> > I'm scared of the vision of countless thousands of computers > > >> > calling strlen(temp_form) and constantly coming up with the same > > >> > number -- 16. Are you not? > > >> > > >> You are shitting me aren't you? I could find _thousands_ of such > > >> constant results in /usr/src. > > > > > > Indeed. Code readability always beats unmeasureable performance losses > > > hands-down. > > > > Common, how is sizeof(foo) less (or more) readable than strlen(foo)? > > DROP IT. OpenBSD and NetBSD uses ``char *foo = "bar";'' > We use ``char foo[] = bar";'' due to Mark's pickier lint. I am not going > to change that line of our code. BUT the other BSD's cannot use `sizeof' > because that will be 4 or 8, which is much less than the ?17? that > `sizeof' would be for us. Thus have to use strlen(), and thus we WILL > use strlen(). > > Go buy yourself a gigahertz Athlon (Duron if you're cheap) and find > something REAL to worry about. > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe cvs-all" in the body of the message . . . besides which, won't (or shouldn't) the builtin strlen() optimize to a constant for lengths determinable at compile time and proven to be static constants? This would seem to be a simple, no-brainer, optimization for the the builtin strlen(). -- _ | |V| / ' || MacroHard -- \ \_| | | \_, || the perfection of form over | ----------------------------------|| substance, marketing over | Web: http://www.borgsdemons.com || performance, and greed over | AIM: johnmcooper || design . . . | =====================================================================/ Public Key: http://www.borgsdemons.com/Personal/pgpkey.asc | =====================================================================\ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1018030764.4511.22.camel>