Topic: const-ness problem


Author: hguller@freenet.vcu.edu
Date: 26 Mar 1995 22:04:00 -0500
Raw View
>void fRun( int const *const pi );
>void fFail( int const *const *const ppi );
>void fFailRun( int *const *const ppi );
>
>main()
>{
>    int *pi, **ppi;
>
>    // Why does this work...
>    fRun( &pi );

when you say it worked, do you mean it compiled and linked
successfully or it executed with no errors or it executed with
no errors and did what you wanted it to?

>    // ...and this not...
>   fFail( &ppi );

The first two are referencing the pointer to int pointers while
the last is referencing an int pointer.

>   // ...and this does work ?
>   fFailRun( ppi );
>}
--
Harold Guller
hguller@freenet.vcu.edu




Author: oschaed@caticsuf.csufresno.edu (Oliver Schaedlich)
Date: 26 Mar 1995 21:39:17 GMT
Raw View
  Hi!

void fRun( int const *const pi );
void fFail( int const *const *const ppi );
void fFailRun( int *const *const ppi );

main()
{
    int *pi, **ppi;

    // Why does this work...
    fRun( &pi );

    // ...and this not...
   fFail( &ppi );

   // ...and this does work ?
   fFailRun( ppi );
}

I'm using Watcom C++ 10.0a and MSVC2.0.