[Insight-developers] ITK Dashboard : unused variable : 12 warnings
Sean McBride
sean at rogue-research.com
Tue Mar 17 10:54:34 EDT 2009
On 3/16/09 7:23 AM, Luis Ibanez said:
>81: inline T& operator () (unsigned i, unsigned j) {
>82: assert(i == j);
>83: return diagonal_[i];
>84: }
>
> *SNIP*
>
>81: #ifdef NDEBUG
>82: inline T& operator () (unsigned i, unsigned ) {
>83: #else
>84: inline T& operator () (unsigned i, unsigned j ) {
>85: #endif
>
>
>Do you see any drawback in making this replacement ?
Luis,
Personally, I find that a little verbose and ugly. :) I suggest the
following:
81: inline T& operator () (unsigned i, unsigned j) {
82: assert(i == j); (void)j;
83: return diagonal_[i];
84: }
Note the added "(void)j". This makes 'j' 'used', but do nothing. It is
a portable way to selectively silence that warning.
We will also be making the change Bill requested to our dashboard
scripts, so the other option is to change nothing. :)
Cheers,
--
____________________________________________________________
Sean McBride, B. Eng sean at rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
More information about the Insight-developers
mailing list