Re: Cannot convert type 'int' to 'bool'
- From: "Jonathan Wood" <jwood@xxxxxxxxxxxxxxxx>
- Date: Fri, 21 Sep 2007 22:48:13 -0600
I don't know why you get this error but it could be related with bool values being limited to 1 or 0. In this case, the int is 1, but I wouldn't want the compiler trying to determine stuff like that--too much overhead.
How about something like this:
bool isTrue = (test != 0);
--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
"John" <no@xxxxxxxx> wrote in message news:u9U4dJN$HHA.1900@xxxxxxxxxxxxxxxxxxxxxxx
The following code:
int test = 1;
bool isTrue = (bool)test;
results in a compiler error:
Cannot convert type 'int' to 'bool'
wtf, any ideas on how to work around this?
.
- Follow-Ups:
- Re: Cannot convert type 'int' to 'bool'
- From: John
- Re: Cannot convert type 'int' to 'bool'
- References:
- Cannot convert type 'int' to 'bool'
- From: John
- Cannot convert type 'int' to 'bool'
- Prev by Date: Cannot convert type 'int' to 'bool'
- Next by Date: Re: LSP Implementation for bandwidth restriction
- Previous by thread: Cannot convert type 'int' to 'bool'
- Next by thread: Re: Cannot convert type 'int' to 'bool'
- Index(es):
Relevant Pages
|
Loading