From: Horst von Brand <vonbrand@inf.utfsm.cl>
To: Jesper Juhl <juhl-lkml@dif.dk>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@osdl.org>, Jeff Garzik <jgarzik@pobox.com>,
Domen Puncer <domen@coderock.org>
Subject: Re: [RFC] cleanup patches for strings
Date: Tue, 21 Jun 2005 17:12:16 -0400 [thread overview]
Message-ID: <200506212112.j5LLCG7V031031@laptop11.inf.utfsm.cl> (raw)
In-Reply-To: Message from Jesper Juhl <juhl-lkml@dif.dk> of "Tue, 21 Jun 2005 00:46:26 +0200." <Pine.LNX.4.62.0506200052320.2415@dragon.hyggekrogen.localhost>
Jesper Juhl <juhl-lkml@dif.dk> wrote:
> I have a bunch (few hundred) of oneliners like the ones below lying around
> on my HD and I'm wondering what the best way to submit them is.
>
> The patches all make the same change, there's just a lot of files the
> change needs to be made in. The change they make is to change strings
> from the form
> [const] char *foo = "blah";
> to
> [const] char foo[] = "blah";
>
> The reason to do this was well explained by Jeff Garzik in the past (and
> now found in the Kernel Janitors TODO) :
Which is dead wrong. A short test program here (Fedora rawhide, i686,
gcc-4.0.0) shows that if you use an array, it is allocated on the stack and
the contents of the (constant, readonly) string is copied there before use,
just as you'd have to expect given C's semantics. I.e., the function gets
larger, slower, and uses more stack. If the array is declared const makes
no difference (AFAIR, it can't, as the const doesn't guarantee it won't be
changed).
--
Dr. Horst H. von Brand User #22616 counter.li.org
Departamento de Informatica Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria +56 32 654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
prev parent reply other threads:[~2005-06-21 21:20 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-20 22:46 Jesper Juhl
2005-06-21 6:58 ` cutaway
2005-06-21 11:02 ` Denis Vlasenko
2005-06-21 13:08 ` cutaway
2005-06-21 13:06 ` Denis Vlasenko
2005-06-21 14:38 ` cutaway
2005-06-21 13:52 ` Denis Vlasenko
2005-06-21 13:20 ` Denis Vlasenko
2005-06-21 8:59 ` Alexey Dobriyan
2005-06-21 9:31 ` Jörn Engel
2005-06-21 20:47 ` Jesper Juhl
2005-06-21 9:04 ` Andrey Panin
2005-06-21 10:59 ` Denis Vlasenko
2005-06-21 21:24 ` Jean Delvare
2005-06-21 22:33 ` cutaway
2005-06-21 21:49 ` Jean Delvare
2005-06-21 23:11 ` cutaway
2005-06-22 0:16 ` Brian Gerst
2005-06-21 21:12 ` Horst von Brand [this message]
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=200506212112.j5LLCG7V031031@laptop11.inf.utfsm.cl \
--to=vonbrand@inf.utfsm.cl \
--cc=akpm@osdl.org \
--cc=domen@coderock.org \
--cc=jgarzik@pobox.com \
--cc=juhl-lkml@dif.dk \
--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®