From: Joe Perches <joe@perches.com>
To: David Wagner <daw-news@cs.berkeley.edu>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] fs/qnx4: decrement sizeof size in strncmp
Date: Thu, 12 Nov 2009 16:06:15 -0800 [thread overview]
Message-ID: <1258070775.9696.20.camel@Joe-Laptop.home> (raw)
In-Reply-To: <hdi6ut$cs9$1@taverner.cs.berkeley.edu>
On Thu, 2009-11-12 at 23:49 +0000, David Wagner wrote:
> Julia Lawall wrote:
> > As observed by Joe Perches, sizeof of a constant string includes the
> > trailing 0. If what is wanted is to check the initial characters of
> > another string, this trailing 0 should not be taken into account. If an
> > exact match is wanted, strcmp should be used instead.
> A caution: Your patch changes behavior. Is there a specific reason
> to believe that the change in behavior is what is desired/intended in
> this context? Lacking any analysis that indicates that the change in
> behavior is desired, I'm skeptical that a behavior-changing patch should
> be applied.
I agree that desired behavior should be known before
patches are applied.
Most likely, this instance should just be strcmp.
That gives better readability, trivially improved
performance, and easier verification.
next prev parent reply other threads:[~2009-11-13 0:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-12 7:49 Julia Lawall
2009-11-12 9:25 ` Anders Larsen
2009-11-12 10:05 ` Julia Lawall
2009-11-12 10:14 ` Julia Lawall
2009-11-12 10:22 ` sizeof vs strlen (was Re: [PATCH 4/4] fs/qnx4: decrement sizeof size in strncmp) Bernd Petrovitsch
2009-11-12 10:37 ` Julia Lawall
2009-11-12 15:33 ` Julia Lawall
2009-11-13 16:42 ` Bernd Petrovitsch
2009-11-12 23:49 ` [PATCH 4/4] fs/qnx4: decrement sizeof size in strncmp David Wagner
2009-11-13 0:06 ` Joe Perches [this message]
2009-11-12 22:08 Anders Larsen
2009-12-18 14:26 ` Jiri Kosina
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1258070775.9696.20.camel@Joe-Laptop.home \
--to=joe@perches.com \
--cc=daw-news@cs.berkeley.edu \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®