Synopsis: | Do not discard const qualifiers in pointer assignments. |
Language: | C |
Severity Level: | 6 |
Category: | Expressions |
Description: |
Justification Discarding const qualifiers in pointer assignments is allowed in C but not in C++. In order to keep code being portable to C++, it is not recommended to perform such assignments. Example const int* p; int* q; q = p; /* WRONG */ const int* p; const int* q; q = p; /* RIGHT */ |