Re: Question on const pointer modifier

From: Matt Taylor (para_at_tampabay.rr.com)
Date: 01/21/04


Date: Wed, 21 Jan 2004 05:21:53 GMT


"Victor Bazarov" <v.Abazarov@comAcast.net> wrote in message
news:2wjPb.108895$8H.221197@attbi_s03...
> "Matt Taylor" <para@tampabay.rr.com> wrote...
> > I was a bit surprised when my compiler (both GCC 3.2 & MSVC 7.1) griped
> > about this piece of code:
> >
> > int i;
> > int *p1 = &i;
> > const int **p2 = &p1; // Invalid type conversion here
> >
> > I was curious as to why this is so. I don't understand how it would be
> wrong
> > to convert an int ** into a const int **. Thanks in advance!
>
> Read C++ FAQ. The one you need is 18.15.

Ah now I understand. Thanks!

-Matt