Author Topic: Debugging Checklist  (Read 3474 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Debugging Checklist
« 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
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.




Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Debugging Checklist
« Reply #1 on: June 16, 2020, 03:26:29 pm »
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.

https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Debugging Checklist
« Reply #2 on: June 18, 2020, 01:06:24 am »
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.
« Last Edit: June 19, 2020, 12:07:24 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Debugging Checklist
« Reply #3 on: June 19, 2020, 12:02:38 pm »
Here is one I ran into last night, had me stumped I wasted time double & triple checking spelling (#1 Bug! it was NOT)

« Last Edit: June 19, 2020, 01:48:02 pm by bplus »

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Debugging Checklist
« Reply #4 on: June 19, 2020, 12:58:04 pm »
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.
Shuwatch!