[futurebasic] Re: [FB] Locking handles (was:Re: [FB] Strings > 255 chara

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 1998 : Group Archive : Group : All Groups

From: Jay Reeve <jktr@...>
Date: Thu, 29 Oct 98 19:07:33 -0600
>< DIM array%(1)
>< resH& = FN GET1RESOURCE(_"DATA",128)
>< LONG IF resH% AND FN RESERROR = _noErr
><     BLOCKMOVE [resH&], @array%(0), 4
>< END IF
>
>The only thing I can see is changing the LONG IF to:
>
>LONG IF (resH& <> 0) AND FN RESERROR = _noErr

>FB does a bitwise AND operation--therefore, when ANDing conditions, always 
>turn 
>each condition into a true/false test in order to ensure that you get the 
>result you are expecting. 

Probably not a bad practice, but it _is_ acceptable to leave one (and 
only one) condition as a non-boolean value, because any value ANDed with 
_ztrue (-1) is unchanged, and any value ANDed with _false (0) becomes 
_false (0). So in the example above, the "FN RESERROR = _noErr" will 
yield either _ztrue or _false, which can be ANDed with any volue of resH& 
to get the desired result.

 0"0
 =J= a  y
  "