This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

warning C102

Hello,

why differentiates the compiler in assigning a "pointer to const" an adress directly or via a function call?

void test (const uint16_t *cpui16)
{
  if (*cpui16 == 17)
    return;
}

void test1(void)
{
      uint16_t  ui16 = 9U;
      uint16_t *p    = &ui16;
const uint16_t *cp   = &ui16; //warning C102:

  test(&ui16);                //no warning
  test(p);
  test(cp);
}

And why marks the compiler a warning and the manual an error?
Compiler
warning C102: '=': different const/volatile qualifiers

Manual
*** Error C102

operator: Different const/volatile Qualifiers

I cannnot imagine a potential problem with

const uint16_t *cp   = &ui16;

Can anybody give me a hint?

Best regards
Jürgen

0