[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AND statements



Martin Schultz <mgs@io.harvard.edu> wrote:

>>     IF NOT (A EQ 0) THEN IF B/A GT 5 THEN <SOMETHING> $
>>     ELSE <SOMETHING_ELSE> $
>>     ELSE <SOMETHING_ELSE>
>> 
>> (Where the second SOMETHING_ELSE is the same as the first one)
>> 
>> [...]
>
>in short this is the same as 
>    IF E1 THEN ( IF E2 THEN A ELSE B ) ELSE C
>
>I don't think there are that many cases where B is really the same as C.

Well I've had it quite often when I've been dealing with pointers and
I want to find out if what a pointer points to is whatever, but ht
epointer might be null. I then obviously have to have a first test for
IF Ptr_Valid(pointer) THEN BEGIN
	IF *pointer EQ whatever THEN BEGIN
			.
			.
			.
			.
	ENDIF ELSE (carry out code for failed pointer)
ENDIF ELSE (carry out code for failed pointer)

The pointer failing due to it not been valid is the same kind of
failing as it not pointing to whatever so I have to either write code
twice or set a flag at (carry..) part and then do 
IF flag EQ 1 THEN .... , 

I think that is certainly better than a goto in that circumstance. I
had to use that several times in the ptr_free program I wrote (see
post of 04/03/'99), but then no-one would know about that been as not
one person has loooked at it - oh well I'll leave programs that are of
use to others to the likes of DWF. 



Jon Kimber
DERA
ENGLAND