This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 317 - Portable way to suppress unused variable warnings
Summary: Portable way to suppress unused variable warnings
Status: RESOLVED FIXED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - general (show other bugs)
Version: 3.0
Hardware: All All
: --- Unknown
Assignee: Benoit Jacob
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-09 12:58 UTC by Marton Danoczy
Modified: 2019-12-04 10:58 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.
Comment 2 Nobody 2019-12-04 10:58:37 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/317.

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