Page 1 of 1

Posted: Sun Jan 12, 2003 11:11 am
by BackupUser
Restored from previous forum. Originally posted by geoff.

I am new to PureBasic but accustomed to using the logical operator NOT which seems to be missing from PureBasic. So for example I would like to use:

If NOT EOF(1)
or similar constructs instead of the more ugly:
If EOF(1)=#FALSE
for example.

I can't use the bitwise operator ~ because in PureBasic #TRUE is defined as 1 and #FALSE is defined as 0. The bitwise NOT of the number 1 is -2 (ie twos complement), so ~#TRUE does not equal #FALSE.

In some languages #TRUE is defined as -1 and #FALSE as 0, so bitwise NOT is the same as logical NOT.

So my question to Fred is, should he change the definition of #TRUE to -1 (I doubt that would be popular) or should he add a logical NOT command that changes 0 to 1 and 1 to 0, so that NOT #TRUE=#FALSE and NOT #FALSE=#TRUE.

Posted: Sun Jan 12, 2003 11:18 am
by BackupUser
Restored from previous forum. Originally posted by plouf.

First Welcome to the community :wink:
PB takes TRUE 0 so any number than 0 is true
-1 = TRUE 1 = TRUE
about the example you make a solution would be to do it
if EOF(1)=0 ; This expression is true if EndOfFile has NOT reached

Christos

Posted: Sun Jan 12, 2003 11:34 am
by BackupUser
Restored from previous forum. Originally posted by geoff.

Thanks, plouf.
It's not an insoluble problem, just ugly.

At the moment I use:
loaded=-1 instead of loaded=#TRUE
ie I define my own #TRUE, different from the one in PureBasic
Then I can say:
If ~loaded, for example

It would be clearer to be able to say:

loaded.l=#TRUE
if NOT loaded

Geoff