qb45advr.hlp (
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
CLEAR Statement Details
◄QuickSCREEN► ◄Details► ◄Example► ◄Contents► ◄Index►
──────────────────────────────────────────────────────────────────────────────
Details
Syntax
CLEAR [,,stack]
The CLEAR statement performs the following actions:
■ Closes all files and releases the file buffers
■ Clears all COMMON variables
■ Sets numeric variables and arrays to zero
■ Sets all string variables to null
■ Reinitializes the stack and, optionally, changes its size
The stack parameter sets aside stack space for your program.
QuickBASIC takes the amount of stack space it requires, adds the
number of bytes specified by stack, and sets the stack size to the
result.
Note: Two commas are used before stack to keep QuickBASIC compatible
with BASICA. BASICA included an additional argument that set the
size of the data segment. Because QuickBASIC automatically manages
the data segment, the first parameter is no longer required.
If your program has deeply nested subroutines or procedures, or if
you use recursive procedures, you may want to use a CLEAR statement
to increase the stack size. You may also want to increase the stack
size if your procedures have a large number of arguments.
Clearing the stack destroys the return addresses placed on the stack
during the execution of a GOSUB. This makes it impossible to execute
a RETURN statement correctly and produces a "RETURN without GOSUB"
run-time error message. Using a CLEAR statement in a SUB or FUNCTION
produces a run-time error message that reads "Illegal function call."
Differences from BASICA
BASICA programs using CLEAR may require modification. In BASICA
programs, any DEF FN functions or data types declared with DEFtype
statements are lost after a CLEAR statement. In compiled programs,
this information is not lost because these declarations are fixed at
compile time.