Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
program crashes about 20% of the time
#11
I could channel Clippy on this OP, but I just remembered... It's Christmas, not Halloween.

Pete
Reply
#12
This really looks like it started as Basic, then migrated to qbasic then to qb64...
Done this a few times myself.
Always start refactoring code to remove goto and gosub and localize variables with strong typing. 
It takes some time, but you win that back in the long run....
45y and 2M lines of MBASIC>BASICA>QBASIC>QBX>QB64 experience
Reply
#13
(12-18-2022, 06:50 PM)mdijkens Wrote: This really looks like it started as Basic, then migrated to qbasic then to qb64...
Done this a few times myself.
Always start refactoring code to remove goto and gosub and localize variables with strong typing. 
It takes some time, but you win that back in the long run....

No need to get rid of "GOTO" and "GOSUB... RETURN" but have to keep track of it carefully. Please don't make QB64(PE) more like Freebasic and Visual Basic for some people.

"ON... GOTO" and "ON... GOSUB" have a way to induce bad habits too. I agree those should be replaced by "SELECT CASE... END SELECT" which is far more readable and easier to control.

A programmer who cannot decide between "GOTO" and "GOSUB" to jump around in code should stop insisting on it. Put the "subroutine" block into a subprogram that could be called by name. Because using "GOSUB" must have a "RETURN" around somewhere. Please remember that in Q(uick)BASIC, and later on in QB64(PE) line numbers are not required, and therefore there is no sense in programming as if the opposite were true. Cannot hate "RETURN without GOSUB" interpreter error message that much as an excuse not to force "subroutines" to be self-contained, or as an excuse to not create subprograms of any kind.

I agree with the strong typing except for people very used to implicit declarations of variables. Again, things have to be examined more carefully because it's left entirely at the programmer's disposal. "OPTION _EXPLICIT" could only do so much, and some coders have a problem with it.
Reply
#14
GOTO is nightmare to debug except in very small self contained blocks of code.

Too many GOSUBs and you are bound to trip over your main code variables, stick with safe local variables in subroutines. Specially when have over 2500 LOC! Routines can be tested independently and once debugged likely to stay debugged.

Besides that's not the issue with this code.

Billy has to narrow down what is causing problems. Crash without error messages does sound like memory leak or stack going past it's storage capacity because of repeated calls either recursively or unintentionally.

I like what Pete said, test like an electrician from start to point A and move point A down the line until error is isolated.
b = b + ...
Reply
#15
Picked it up... trying to run it now
after some minor changes; have it running
Created customer and order for small pizza.....

When is it crashing? how to recreate the issue?
Any steps I can do to have it crash?
45y and 2M lines of MBASIC>BASICA>QBASIC>QBX>QB64 experience
Reply
#16
Noticed in Sub CUSTINFO several very tricky things are going on....
GoSub FUNCTIONS does not always Return "If KEYPRESS = 27 Or T = 27 Then Exit Do" is a serious NO
In general this Sub is very spaghetti-like and really hard to test if it does not create stack/heap overflows

I'd start restructuring Sub CUSTINFO
45y and 2M lines of MBASIC>BASICA>QBASIC>QBX>QB64 experience
Reply
#17
+1 for effort. Even without missing a RETURN you can burn up your stack space by deeply nested GOSUB statements that run in a loop. The system has to keep piling all those other sub calls and gosubs on top of the first non-returned GOSUB. No nice way to say it, that's just a programming trap and the OP probably fell in it if this does turn out to be a stack space crash issue. Again, running task manager and checking memory alongside the running app would be beneficial. I miss how QuickBASIC was able to track stack space with FRE().

Pete
Reply
#18
@billythebull, try the following to increase the stack size
click on C++ Compiler Settings and then in the C++ Linker Flags paste -Wl,--stack,16777216
Reply
#19
Is there a way to beep or create message when stack is be taken to limits and say trace it back to the routine or line number doing it? perhaps on error something....
b = b + ...
Reply
#20
(12-19-2022, 12:31 AM)Jack Wrote: @billythebull, try the following to increase the stack size
click on C++ Compiler Settings and then in the C++ Linker Flags paste -Wl,--stack,16777216

In QuickBASIC we just used: CLEAR , , 2000 to increase the stack. I can't even imagine needing CLEAR , , 16777216. Not that we can do that in QB64. Maybe some dev should put that option back in place. As it is now, QB64 ignores the memory parameters in CLEAR.

Pete
Shoot first and shoot people who ask questions, later.
Reply




Users browsing this thread: 1 Guest(s)