W
werasm
Hi all,
I'm looking for a nice clean (portable) way to get rid of unused
variable warnings without fiddling with compiler settings (on a per
case basis). I've come up with this:
template <class T>
inline void valueUsed( const T& ){}
int main()
{
int v( 0 );
const int& x( v );
int& y( v );
valueUsed( v );
valueUsed( x );
valueUsed( y );
}
Any foreseen pitfalls with this solution?
Regards,
Werner
I'm looking for a nice clean (portable) way to get rid of unused
variable warnings without fiddling with compiler settings (on a per
case basis). I've come up with this:
template <class T>
inline void valueUsed( const T& ){}
int main()
{
int v( 0 );
const int& x( v );
int& y( v );
valueUsed( v );
valueUsed( x );
valueUsed( y );
}
Any foreseen pitfalls with this solution?
Regards,
Werner