Function argument can be made const not working for pointers

Feature request: Pointer argument can be made const

Given the following function:

Snippet


void
 foo (int * barint baz) {     *bar = 2 * baz; }

Then R++ correctly proposes that baz can be made const. (a new feature (?) that I really appreciate)

However, R++ fails to also propose that bar can be made const like such:

Snippet

void foo (int * const barint const baz)

 

Snippet

 

As I rarely assign a new pointee to a pointer almost all my pointers can (and should) be made const.

This is different from pointer to const, e.g., int const * bar

 

 

3 comments

Thanks, did as you asked.

Sorry for having posted in the wrong location.

0

It's totally ok, that's what the forum is for :) We discussed this internally some time ago and were divided whether this is worth implementing, but now maybe we'll add an inspection that detects non-const pointers.

0

Please sign in to leave a comment.