Re: RFC: String cleanup

On 12/16/05, Benoît Dejean <benoit placenet org> 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:
> > > 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.
const char * const str is much closer to being equivalent to const char str[] .
A constant pointer to constant characters. So either giving more const
hints or using the array notation, might give more hints to the
optimizer which may or may not cause changes to the outputed code.

> > that's one more printer in memory, and a dereferenciation.


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