Re: Feature or bug: implicit cast from false to 0
- From: "Bo Persson" <bop@xxxxxx>
- Date: Fri, 5 Aug 2005 15:40:15 +0200
"Mihajlo Cvetanoviæ" <mac@xxxxxxxxxxxxxxxxxx> skrev i meddelandet
news:OKA5sFcmFHA.3544@xxxxxxxxxxxxxxxxxxxxxxx
> 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
.
- References:
- Feature or bug: implicit cast from false to 0
- From: Mihajlo Cvetanović
- Feature or bug: implicit cast from false to 0
- Prev by Date: Re: VC++ .net 2005 express beta 2
- Next by Date: Re: VC6 speed vs VS2003
- Previous by thread: Feature or bug: implicit cast from false to 0
- Next by thread: propIdl.h redifinition issues
- Index(es):
Relevant Pages
|