Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CleanUp Routine, FREEIMAGE, FREEFONT
#4
(05-23-2024, 05:02 AM)NakedApe Wrote: Gotcha. Thanks, Steve. And what about the loaded sounds question? Do all loaded sounds need to be _sndclosed or does QB free sounds upon terminating a program as the wiki states?

Everything tends to automatically get freed when a program closes and exits memory.  Technically, you don't *HAVE* to write those lines yourself, but a whole lot of folks like to do so, almost on muscle-memory alone, so they just never accidently forget and have it bite them in the butt.  Wink

Think of it just the same as opening and closing a file FOR INPUT or OUTPUT.

Code: (Select All)
OPEN "temp.txt" FOR OUTPUT AS #1
PRINT #1, "Hello World"
Compile.  Run.  Everything works as expected and with zero problems...

...but it just somehow seems incomplete to me!!  CLOSE really isn't *necessary* here, as the end of the program will close that file handle -- but that's like saying, "Gosh, clothes aren't really *necessary* inside your own house!!"    Sure, they might not be, but you sure as hell end up feeling naked without them! 

Big Grin

If I ever write an OPEN statement and it doesn't have a corresponding CLOSE statement in my program, then I was drunk, exhausted, or lazy -- or some combination of all three!  It just doesn't feel right without one, though *technically*, there's actually no issues with leaving them out of your code.

*Technically*, there's nothing saying you have to wear clothes in the comfort of your own home.  The problem comes when you get so comfortable doing it, that you go out to check the mail in the buff and end up getting reported by the neighbors!

Wink
Reply


Messages In This Thread
RE: CleanUp Routine, FREEIMAGE, FREEFONT - by SMcNeill - 05-23-2024, 05:13 AM



Users browsing this thread: 1 Guest(s)