Bug 317 - Portable way to suppress unused variable warnings
Portable way to suppress unused variable warnings
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Core - general
3.0
All All
: --- Unknown
Assigned To: Benoit Jacob
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-07-09 12:58 UTC by Marton Danoczy
Modified: 2014-02-24 18:21 UTC (History)
2 users (show)



Attachments

Description Marton Danoczy 2011-07-09 12:58:24 UTC
Hi,

Herb Sutter [1] recommends getting rid of unused variable warnings via the template

template<class T> void unused_variable(const T&) {}

He recommends against Eigen's practice of casting to void. Maybe it would make sense to change EIGEN_UNUSED_VARIABLE? Besides, one macro less is one macro less...

Marton

[1] http://herbsutter.com/2009/10/18/mailbag-shutting-up-compiler-warnings/
Comment 1 Gael Guennebaud 2014-02-24 18:21:58 UTC
This also fixed a weird issue with clang optimizing a function call.

https://bitbucket.org/eigen/eigen/commits/a7374a9a62b7/
Changeset:   a7374a9a62b7
User:        ggael
Date:        2014-02-24 18:13:49
Summary:     Implement bug 317: use a template function call to suppress unused variable warnings. This also fix the issue of the previous changeset in a much nicer way.

https://bitbucket.org/eigen/eigen/commits/7662ce6119c5/
Changeset:   7662ce6119c5
Branch:      3.2
User:        ggael
Date:        2014-02-24 18:18:52
Summary:     Implement bug 317: use a template function call to suppress unused variable warnings.

Note You need to log in before you can comment on or make changes to this bug.