tags:

views:

501

answers:

1
+8  A: 

Say you had the following function:

void test(  const char*& pRef)
{
    static const char somedata[] = { 'a' ,'b', 'c', '\0'};
    pRef = somedata;
}

If you passed in a non-const char*, then when test() returned the compiler would have lost the fact that what p is pointing to is const.

It's essentially the same reason as given in this C++ FAQ Lite question (dealing with pointers-to-pointers rather than pointer references):

Michael Burr
That would explain it. Argumentum ad Parashift has always been a convincing tactic.
ChrisV