Possible Duplicate:
What is the purpose of the statement “(void)c;”?
class ArgString : public Arg::Base
{
public:
...
bool CanConvertToInt() const
{
const char *cstr = mValue.c_str();
char *result = 0;
long d = strtol(cstr, &result, 10);
(void) d; // what is the usage of this line?
return result != cstr;
}
private:
std::string mValue;
};
Can someone tell me what the purpose of the following line is?
(void) d;
Thank you
// Update //
As some people pointed out, the purpose of the line is to suppress the compilation warning. To me, that is very strange. Because this is much severe warning
warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use
_CRT_SECURE_NO_WARNINGS. See online help for details.
Why we ignore this big warning and ONLY address the smaller one.