0

But static_cast from const char * to CPVOID, which is typedef const void *, is seamless.

Is there some difference between const PVOID and CPVOID, that I don't understand?

Code:

typedef void * PVOID;
typedef const void * CPVOID;

int main()
{
    const char * c = nullptr;

    CPVOID e = static_cast<CPVOID>(c);             // Ok
    const PVOID f = static_cast<const PVOID>(c);   // Error
}

Wider example on Coliru

Vizor
  • 396
  • 3
  • 14
  • 2
    `const PVOID` "is" `const (void *)` which is `void * const`, so a constant pointer to void, whereas CPVOID is a pointer to constant void – Justin Jan 24 '18 at 21:54
  • 1
    [Some](https://stackoverflow.com/q/2253738/1896169) [things](https://stackoverflow.com/q/1808471/1896169) that are near duplicates. Together with [this](https://stackoverflow.com/q/1143262/1896169), that should complete all the information needed to answer this question – Justin Jan 24 '18 at 21:55

0 Answers0