2

I am cleaning all the warning for given codes.(Which means I am not fully understand each line logic). "[-Wunused-parameter]" is enabled and shall not be turned off.

And for "unused parameter", we usually just use "_ _ attribute _ _((unused))".

While for following functions, I can't use that above trick.

void fun(int* a =0){
    ----variable ptr a is not used at all----
}

Any good idea to have a clean solution to remove the warning?

nbanic
  • 1,270
  • 1
  • 8
  • 11
thundium
  • 995
  • 4
  • 12
  • 30

1 Answers1

5

This easiest way is not to name the parameter:

void fun(int* =0){
    //...
}
Mike Seymour
  • 249,747
  • 28
  • 448
  • 644