Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Branchless code

Author: Sune Fischer

Date: 05:09:48 11/19/02

Go up one level in this thread


On November 19, 2002 at 07:50:57, Gerd Isenberg wrote:

>>I always get warnings when casting to boolean, I never get warnings usually when
>>casting, in fact I cast to get rid of those warnings, so something must be going
>>on.
>
>What do you assign to bool? Assigning relational or logical expressions should
>be fine without any warning. Of course if you assign an int to bool the compiler
>is right to warn you, because of the rather different value ranges.
>
>Btw. the build in C++ type "bool" is often implemented with byte size.
>Due to performace reasons, it might be advantageous to use an own typedef like

Yes, that's it, it's a performance warning.

>typedef int BOOL;
>
>#ifndef TRUE
>#define FALSE 0
>#define TRUE 1
>#endif

I don't think I get it, you suggest to cast to int instead, what is the rest
for?

Anyway, I hardly ever do cast to bool, it's working fine without it so it's
probably just wasted clocks?

-S.
>Gerd



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.