Tuesday, October 10, 2017

C++17: [[maybe_unused]] Attribute

C++17 the [[maybe_unused]] attribute to handle a case where a variable is only sometimes used during a compile. An example of this is a variable that is only used in an assert() statement. When compiled in debug mode, this variable would be used; but when compiled in release mode, this variable would not be used.  This attribute disables the unused variable warning for variables specified with this attribute.

References:

No comments:

Post a Comment