Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A Question on Calls to Subroutines
#2
DIM SHARED makes a variable completely global, everywhere in the program. Such a variable is not protected inside a subprogram, and much less inside a GOSUB subroutine.

Probably trying to force it local inside a subprogram by using STATIC creates a "Duplicate definition" error message. But I've been surprised before by this BASIC dialect.

Subprograms and other code that is not called will be added to the program while it's compiled. It will be part of the final EXE file or counterpart on Linux or MacOS. If you are somebody who cares a lot about executable file sizes then it's better to analyze which portions of the program are not being called and exclude them altogether. This is most noticeable with fonts, graphics and music support. If there's anything that looks like it calls upon loading a JPEG or WAV, or asks to set a different font, whether or not that subprogram or GOSUB subroutine is actually executed in your program, it will be involved in the final executable created by QB64PE.
Reply


Messages In This Thread
A Question on Calls to Subroutines - by Dimster - 11-22-2023, 04:43 PM
RE: A Question on Calls to Subroutines - by mnrvovrfc - 11-22-2023, 09:24 PM



Users browsing this thread: 1 Guest(s)