Understood.
I just can't recall an instance in all these years where I've been bit by this feature.
Thanks for the tutelage.
W.
-----Original Message-----
From: futurebasic@... [mailto:futurebasic@...] On Behalf Of Robert Purves
Sent: Monday, September 05, 2011 12:03 AM
To: futurebasic@...
Subject: Re: [FB] FBtoC bug?
Waverly wrote:
> Would the team consider the following translation
> if ( someValue ) ... // fb
> to
> if ( someValue != 0 )... // C
That single change would make no difference. In C, the 'if' expression is evaluated and the conditional code taken when the evaluation is non-zero.
I guess you are asking for more. You would like your original expression
>> if ( ( acceptCount ) && ( storeArray ) ) ...
transmuted to
if ( ( acceptCount != 0 ) & ( storeArray != 0 ) ) ...
I don't think that possible without breaking existing code, for example 64-bitwise logic in a chess program.
if ( ( myAttacks ) && ( oppositeSideK ) ) then check = _zTrue
> I recall the tests have always been bitwise however there must have been something the original FB did to prevent this simple failure.
You are perhaps thinking of _zTrue, which in FB is one of the two possible results of a boolean expression. Its value (all bits set; -1) makes it work in conditional expressions like this one:
if ( anyBitSet and ( someVal > 3 ) ) then beep
A Boolean result in C is 0 or 1, hence the minus sign in the translation:
if ( (anyBitSet) & (-(someVal > anyBitSet)) )
{
SysBeep( 1 );
}
Robert P.
--
To unsubscribe, send ANY message to: futurebasic-unsubscribe@...
To access the list archives, go to: http://freegroups.net/groups/futurebasic/