ResharperC++ suggests to make method const

352 Views Asked by At

ResharperC++ suggests to make a class method const even if in the method the data is accessed through members. I know this is legal to make them const, but I was wondering if it is possible to disable this suggestion somehow or even better reverse it, so it issues a suggestion if this method would be declared const.

An example would be

void test()
{
    data->myData = 3;
}

ResharperC++'s outputs: Member function may be 'const'

P.S. I also do not want to enter an argument about const-correctness, but would only very much like to know how to make this happen ;)

enter image description here

1

There are 1 best solutions below

1
Igor Akhmetov On

If you want to disable the inspection just for this specific occurrence, you can ask ReSharper to insert a comment which will suppress the inspection. To do that, click "Disable once with comment" in the inspection submenu of the Alt+Enter context menu. See Suppressing code inspections in specific scope for details.