On Sat, Apr 16, 2005 at 01:13:46PM +0800, Steve Yee wrote:

> the following code can not compile. is it due to the standard?

Yes, this is not valid C++.  int* -> const int* creates a temporary and
you can't bind a non-const reference to a temporary.

You might mean
void testfun(int * const & pr)
or just
void testfun(int * pr)

GCC is correct to reject this code so if you want more information you
should try somewhere like comp.lang.c++

> void testfun(const int *&pr)
> {
> }
> 
> main()

Should be "int main()"

> {
>      int *p;
>      testfun(p);
> }

hope that helps,

jon

-- 
"Democracy is the theory that the common people know what they want, and 
 deserve to get it good and hard."
        - H.L. Mencken

Reply via email to