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.
True or False
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
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
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