05-23-2024, 05:13 AM
(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.
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"
...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!
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!