From: John Daiker <daikerjohn@gmail.com>
To: Anton Altaparmakov <aia21@cam.ac.uk>
Cc: Joe Perches <joe@perches.com>,
kernel-janitors@vger.kernel.org, aia21@cantab.net,
linux-ntfs-dev@lists.sourceforge.net,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] NTFS: Change string pointers to string constants.
Date: Tue, 08 Dec 2009 11:16:42 -0800 [thread overview]
Message-ID: <4B1EA61A.2000804@gmail.com> (raw)
In-Reply-To: <1260236833.3215.237.camel@Joe-Laptop.home>
On 12/07/2009 05:47 PM, Joe Perches wrote:
> On Tue, 2009-12-08 at 00:57 +0000, Anton Altaparmakov wrote:
>> Can you please explain the rational for making this change?
>
> Perhaps it's not worth much, but it saves a pointer reference.
>
> $ cat pointer.c
> #include<string.h>
> #include<stdio.h>
>
> int main (int argc, char** argv)
> {
> static const char *foo = "abcdefg";
> printf("%s\n", foo);
> return 0;
> }
>
> $ gcc -c pointer.c
> $ size pointer.o
> text data bss dec hex filename
> 37 4 0 41 29 pointer.o
>
> $ cat reference.c
> #include<string.h>
> #include<stdio.h>
>
> int main (int argc, char** argv)
> {
> static const char foo[] = "abcdefg";
> printf("%s\n", foo);
> return 0;
> }
>
> $ gcc -c reference.c
> $ size reference.o
> text data bss dec hex filename
> 36 0 0 36 24 reference.o
>
>
>
As Joe mentioned above (thanks Joe!) it saves a pointer reference.
It is also listed as a KernelJanitors ToDo item (about 2/3 of the way
down the page). Searching for 'From: Jeff Garzik' should find it.
John
[1] http://kernelnewbies.org/KernelJanitors/Todo
next prev parent reply other threads:[~2009-12-08 19:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-03 2:53 [PATCH] NTFS: Change string pointers to string constants John Daiker
2009-12-08 0:57 ` Anton Altaparmakov
2009-12-08 1:47 ` Joe Perches
2009-12-08 19:16 ` John Daiker [this message]
2009-12-09 14:59 ` Marcin Slusarz
2009-12-09 15:07 ` walter harms
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=4B1EA61A.2000804@gmail.com \
--to=daikerjohn@gmail.com \
--cc=aia21@cam.ac.uk \
--cc=aia21@cantab.net \
--cc=joe@perches.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-ntfs-dev@lists.sourceforge.net \
/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