Mark Unused Variable

03 Apr 2021

[ c++  ]

Options

1) No variable:

void func(int, int b);

2) From <tuple> header

std::ignore = func();

3) boost::ignore_unused

4) NOTUSED(_client) defined as

template <class T>
inline void NOTUSED( T const & result ) { 
   static_cast<void>(result); 
}

5) According to C++ standard:

void func(int a [[gnu::unused]],
          int b);

6) C++ attribute: maybe_unused in C++17