"Mihajlo Cvetanović" <ma*@RnEeMtOsVeEt.co.yu> skrev i meddelandet
news:OK**************@TK2MSFTNGP15.phx.gbl...
Observe this code (VC7.1):
void Test(const char*)
{
}
int main(void)
{
Test( false ); // OK
Test( true ); // error C2664: cannot convert from bool to const
char*
}
Shouldn't the first call also produce the compiler error?
No - false, 0, NULL, 1 - 1, etc are all examples of constant integral
expressions, that can be used as the null pointer value.
Test(false) works just as well as Test(0) or Test(NULL).
Bo Persson