QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: bplus on June 16, 2020, 11:45:51 am
-
Made this comment in "Opening Files" thread but it seems a good idea to start a list of our acquired wisdom about debugging:
Quote from: SpriggsySpriggs on Today at 07:44:49 AM
When I use the above code in an InForm program the file filter only works in 32 bit. I discovered that the issue must have been the DEFINT A-Z that was causing an issue for this. I removed that and it suddenly worked. Thank you all so much.
Ah the power of habit, so powerful when it saves us time from considering every little thing and leaves us blind when it works against our goals.
Good one to put on your debugging list: "Default Types" along with Typos and notes about INKEY$ and IF logic cautions (a whole sublist special cases for keywords) and what _LOADFILE returns when fails.
Have you started your list? ;)
Oh, from last night the problem _DISPLAY and the cure _AUTODISPLAY
Feel free to add to list your discoveries, we can save ourselves from untold time waste and frustration.
-
Here's one which bites me in the rump all the time:
NOT does not EQUAL FALSE.
IF NOT X THEN... <== This is not the same thing as IF X <> TRUE THEN... The only time NOT X can be used in such a manner is when X is a BIT value. Any other time, the above statement can bite you in the ass!!
IF NOT X THEN....
With the above, if x is 0, the statement is true, and if x is -1, the statement is false. Unfortunately, if x is 3, it's also true. Same if x is 4, 16, 22.4, or 68969696969! Only if x is -1, is that statement false!! And that, generally speaking, may not be what the programmer is wanting to happen at all.
-
SHARED variables with sub routines.
I keep them all at the top of my main code to keep track, I usually SHARED with all subroutines.
-
Here is one I ran into last night, had me stumped I wasted time double & triple checking spelling (#1 Bug! it was NOT)
-
SHARED variables with sub routines.
I keep them all at the top of my main code to keep track, I usually SHARED with all subroutines.
I, too, like to keep all my SHARED variables at the top. It really does help.