Restoring context that has since been snipped (this is not a complaint,
I just need to refer to this context):
David Schwartz wrote: ....
David said:
I don't have the exact warning handy, but the gist of it was that
there is an implicit cast from an integer to a boolean that has a
performance cost.
Now that I think about it, the '!' may not have been there.
If the MSV diagnostic is triggered by the type of if-condition, that
must certainly be the case. As written, the type of the if-condition
would have been 'int' regardless of the type returned by the function.
In the rest of my response, I'll assume that it was not there.
The C standard allows diagnostics to be issued for any reason the
implementation wants, and does not mandate the truthfulness of the text
of those diagnostics (it doesn't even mandate they they be written in
any known language). However, as a user I prefer truthful diagnostics,
and that one isn't.
This code involves no casts. There's no such thing as an implicit cast,
only implicit conversions - a cast is an explicit conversion. The C
standard specifies no conversion to bool; only that the if-condition be
compared for equality with 0. In C++, there is indeed a conversion to
bool (6.4p4), but this message was posted to comp.lang.c, and in C there
is no such conversion.
Since 0 has an 'int' type, when FunctionsThatNowReturnsInt() returned
bool, performing that comparison would technically have required a
conversion from bool to int (though probably with no real performance
cost). Changing the return type to 'int' removed the need for a
conversion; it didn't create such a need.
....
template <typename T> static void numtostring(T n, char *buf)
Again, this is comp.lang.c: C++ templates are off-topic. I see that the
subject line is refers to VC++, which suggests that including
comp.lang.c rather than comp.lang.c++ may have been a mistake; but we do
receive inquiries on comp.lang.c about using VC++ with options that make
it a strictly C compiler, and until this morning's messages, that's what
I assumed was the case for this thread.