This is the mail archive of the
mailing list for the GCC project.
Re: There can be only one version_string
On Fri, Sep 20, 2002 at 08:55:48PM -0400, Kaveh R. Ghazi wrote:
> > From: Zack Weinberg <firstname.lastname@example.org>
> > On Fri, Sep 20, 2002 at 06:31:37PM -0400, Kaveh R. Ghazi wrote:
> > >
> > > How is const char more memory efficient than const char *const ?
> > const char is just the string; const char *const is the string and a
> > read-only pointer to that string.
> Hmm, I thought gcc optimized the latter into the former. Or maybe
> only with automatic variables? I could be wrong...
See for yourself -
$ cat test.c
const char *const x = "x";
const char y = "y";
$ ./xgcc -B./ -S test.c
$ cat test.s
.type x, @object
.size x, 4
.type y, @object
.size y, 2
.ident "GCC: (GNU) 3.3 20020920 (experimental)"