Poll: Unseen is crazy...
You do not have permission to vote in this poll.
Defo...no doubt...
100.00%
1 100.00%
Defo again - but he may actually be on to something here...
0%
0 0%
Total 1 vote(s) 100%
* You voted for this item. [Show Results]

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Arbitrary CONST values
#28
(10-28-2025, 11:30 PM)Unseen Machine Wrote: I think also I may have found a small bug... 


To demonstrate : 
Code: (Select All)

CONST True = 1
CONST False = NOT True '// Therefore anything not 1 = FALSE

PRINT "My false is = 0 so as False is supposed to be anything thats not true lets see if 0 = False!"

FOR i% = 0 TO 15
  PRINT True, False '// Lets see if they stay the same
  IF 0 = False THEN PRINT "0 = false" ELSE PRINT "0 whilst not being = true is not actually false!"
NEXT

I noticed it a while back when using flags to control gl without using a SPECIFIC True Value. Just saying True = not false, my Gl loop would run when it shouldn't...is it a bug or expected behaviour....

John



    I understand your confusion but this is expected and how almost all BASIC's act.

NOT in BASIC is BITWISE not logical      


1 as an int is   &B0000000000000001


NOT 1 is &B1111111111111110


  This is a non zero value and acts as TRUE.


Only NOT -1 ends up being 0   So TRUE should be -1   



BTW: In QB64PE 4.2    _TRUE & _FALSE are already pre defined so just use those. 

Try this code.  

Code: (Select All)
FOR I = -2 to 3
        print _BIN$(NOT I)
NEXT
Reply


Messages In This Thread
Arbitrary CONST values - by Unseen Machine - 10-25-2025, 11:25 PM
RE: Arbitrary CONST values - by SMcNeill - 10-25-2025, 11:41 PM
RE: Arbitrary CONST values - by Unseen Machine - 10-26-2025, 12:01 AM
RE: Arbitrary CONST values - by bplus - 10-25-2025, 11:51 PM
RE: Arbitrary CONST values - by bplus - 10-26-2025, 12:15 AM
RE: Arbitrary CONST values - by Unseen Machine - 10-26-2025, 12:26 AM
RE: Arbitrary CONST values - by ahenry3068 - 10-26-2025, 02:48 PM
RE: Arbitrary CONST values - by CharlieJV - 10-26-2025, 06:06 PM
RE: Arbitrary CONST values - by ahenry3068 - 10-26-2025, 08:16 PM
RE: Arbitrary CONST values - by bplus - 10-26-2025, 05:35 PM
RE: Arbitrary CONST values - by bplus - 10-26-2025, 06:37 PM
RE: Arbitrary CONST values - by bplus - 10-26-2025, 10:50 PM
RE: Arbitrary CONST values - by ahenry3068 - 10-27-2025, 01:28 AM
RE: Arbitrary CONST values - by bplus - 10-27-2025, 01:48 AM
RE: Arbitrary CONST values - by ahenry3068 - 10-27-2025, 04:29 AM
RE: Arbitrary CONST values - by SMcNeill - 10-27-2025, 02:12 AM
RE: Arbitrary CONST values - by CharlieJV - 10-27-2025, 02:17 AM
RE: Arbitrary CONST values - by Unseen Machine - 10-27-2025, 02:36 AM
RE: Arbitrary CONST values - by bplus - 10-27-2025, 08:18 AM
RE: Arbitrary CONST values - by a740g - 10-27-2025, 09:37 AM
RE: Arbitrary CONST values - by SMcNeill - 10-27-2025, 09:45 AM
RE: Arbitrary CONST values - by Jack - 10-27-2025, 12:05 PM
RE: Arbitrary CONST values - by a740g - 10-27-2025, 06:06 PM
RE: Arbitrary CONST values - by Kernelpanic - 10-27-2025, 08:41 PM
RE: Arbitrary CONST values - by Pete - 10-28-2025, 06:57 AM
RE: Arbitrary CONST values - by Unseen Machine - 10-28-2025, 11:22 PM
RE: Arbitrary CONST values - by Unseen Machine - 10-28-2025, 11:30 PM
RE: Arbitrary CONST values - by ahenry3068 - 10-29-2025, 12:31 AM
RE: Arbitrary CONST values - by Unseen Machine - 10-29-2025, 01:50 AM
RE: Arbitrary CONST values - by bplus - 10-29-2025, 02:27 AM
RE: Arbitrary CONST values - by ahenry3068 - 10-29-2025, 02:56 AM
RE: Arbitrary CONST values - by bplus - 10-29-2025, 05:44 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Upcoming changes to CONST may affect your code SMcNeill 14 2,716 12-30-2023, 05:13 PM
Last Post: Kernelpanic
  TYPE and CONST within SUB/FUNCTION TerryRitchie 9 1,939 07-11-2023, 01:22 AM
Last Post: bplus
  suggestion: initialize array values within the DIM statement bobalooie 19 3,312 12-22-2022, 06:46 PM
Last Post: Kernelpanic
  Convert IPv4 dotted quad into four decimal values bert22306 6 1,528 10-31-2022, 03:30 AM
Last Post: bert22306
Bug Color CONST Warning v1.5+ bplus 3 797 05-05-2022, 06:13 PM
Last Post: Pete

Forum Jump:


Users browsing this thread: 1 Guest(s)