Re: Warning fix in gnome-libs/libgnomeui/gnome-less.c



George wrote:
> 
> > I am curious, as there was a discussion on what is correct:
> >
> > const char *x or char const *x.
> >
> > I feel lost without a manual.
> 
> [this is not from memory but froma book so don't think I actually know
> all this:)]
> 
> it's supposed to be: "const char* p" makes the data pointed to by the
> pointer constant, "char *const p" makes the pointer a constant but the
> data it points to can change ... so definately we most likely want the
> first one
> 
 
The trick is to read from right to left.

const char* p;

"p is a pointer to a character constant"

char *const p;

"p is a constant pointer to a character"



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