I'm having a problem which I'm sure is simple to fix but I'm at a loss...
I have a template that performs the following code:
T value = d;
if ( std::numeric_limits< T >::is_signed )
{
if ( value < 0 )
{
*this += _T( "-" );
value = -(signed)value;
}
}
Now for, obvious reasons, GCC is giving me a warning (comparison is always false due to limited range of data type) when this code is compiled for an unsigned type. I fully understand the reasoning behind this and I put in the numeric_limits check to see if I could get the compiler to shut up about it (it worked for MSVC). Alas under GCC I get the warning. Is there any way (short of disabling the warning which I don't even know if you can do with GCC) to fix this warning? The code will never get called anyway and I would assume the optimiser will compile it out as well but I can't get rid of the warning.
Can someone give me a solution to this?
Cheers!