All constexpr variables are const

constexpr char* prefix = "ChannelConfig";

SonarCloud said “Global Pointer should be const at every level”. However, all constexpr variables already are const. It seems false positive.

Hello @Ted_Kim

Here, only the pointer is constant but not the individual chars pointed by it. The rule suggests writing this instead:

constexpr char const* prefix = "ChannelConfig";

I hope that helps.

Hello @Ted_Kim,

I’ve marked the previous answer as the solution but do let me know if you need further help or clarification on this topic.


1 Like

@marco.antognini Thank you for your help. I have one more question. Can I disable this specific rule?

Hi @Ted_Kim,

You can find instructions on how to do that for SonarCloud here: Managing Quality Profiles | SonarCloud Docs.

If you need further help with this, please open a new thread. We try to keep one question per thread.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.