How to 'hide' spurious "declared but never used" warnings?
- by Roddy
I'm using the C++Builder compiler which has a minor bug that certain static const items from system header files can cause spurious "xyzzy is declared but never used" warnings.
I'm trying to get my code 100% warning free, so want a way of masking these particular warnings (note - but not by simply turning off the warning!)
Also, I can't modify the header files. I need a way of 'faking' the use of the items, preferably without even knowing their type.
As an example, adding this function to my .cpp modules fixes warnings for these four items, but it seems a bit 'ad-hoc'. Is there a better and preferably self-documenting way of doing this?
static int fakeUse()
{
return OneHour + OneMinute + OneSecond + OneMillisecond;
}