Re: RFC: String cleanup



On Fri, 2005-12-16 at 16:37, Benoît Dejean wrote:
> Le vendredi 16 décembre 2005 à 16:16 +0100, Xavier Bestel a écrit :
> > On Fri, 2005-12-16 at 16:11, Benoît Dejean wrote:
> > 
> > > > Changing from:
> > > >   [const] char *str
> > > > to:
> > > >   [const] char str[]
> > > 
> > > Isn't that exactly the same ?
> > 
> > const char str[] is a string of chars (and a symbol pointing of them).
> > 
> > const char *str is a string of char and a pointer on them (and a
> > symbol).
> 
> I don't get it. To me, it's is exactly the same, the [] notation giving
> extra information that str is going to be used like an array.
> 
> > that's one more printer in memory, and a dereferenciation.
> 
> compile something with */[] : i get exactly the same asm output

I don't.
In both cases the string is sotred in .rodata, but in the * case I have
a pointer in .data (and access goes through that pointer).

	Xav





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]