This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Char *Foo = "ABC" or Char Foo[] = "ABC"" ?
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Henderson <rth at redhat dot com>, Felix Oxley <lkml at oxley dot org>, gcc at gcc dot gnu dot org
- Date: Sat, 8 Oct 2005 17:02:23 +0200
- Subject: Re: Char *Foo = "ABC" or Char Foo[] = "ABC"" ?
- References: <200510071906.23600.lkml@oxley.org> <20051007183946.GA16708@redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Oct 07, 2005 at 11:39:46AM -0700, Richard Henderson wrote:
> That said, some ABIs over-align arrays, and so you might get more
> padding with arrays than raw strings. But it'll be less than the
> size of an extra pointer variable.
Plus constant merging will not happen (at least not unless
-fmerge-all-constants) when using:
const char foo[] = "Hello, world!";
in one file and
const char bar[] = "Hello, world!";
in another one (or even in the same file), while the strings are merged
for
const char *foo = "Hello, world!";
and
const char *bar = "Hello, world!";
in another file.
Jakub