Category : BASIC Source Code
Archive   : QBBUG2.ZIP
Filename : QUIRKS.TXT

 
Output of file : QUIRKS.TXT contained in archive : QBBUG2.ZIP

New items for this release 12/23/87:

Part 1 - TYPE..END TYPE
Part 2 - Long Integers
Part 3 - Sample program #2
-------------------------------------------------------------------------

This file contains information about bugs, quirks, and general points
of interest to programmers working with compiled BASIC. It is divided
into three parts:

Part 1 - Description of bugs, quirks and errors
Part 2 - General points of interest
Part 3 - Sample programs

If you want to find one of the above quickly, use your text editor to
search for the text shown above. i.e., Search for "Part 1 -".

This file was compiled by Mark Novisoff of MicroHelp, Inc. Much of the
information was contributed by members of MicroHelp's BASIC Users Group.
If you have additional information that should be added, please send it
to:
Mark Novisoff
MicroHelp, Inc.
2220 Carlyle Drive
Marietta GA 30062
(404) 973-9272
Compuserve ID 73047,3706 in MSSYS (Microsoft Systems Forum)

Part 1 - Description of bugs, quirks and errors

Command/Error Compilers Description
-------------- --------------- --------------------------------------------
CALL (asm) QB 4 Effective with QB 4, assembly
language subroutines must preserve
the SI and DI registers and make
sure the direction flag is cleared
before returning to BASIC.
CALL INIT QB 2-3 Do not name a precompiled subprogram "INIT".
If you do, the compiler will go into never-
never land when your user library is loaded.
CALL vs GOSUB All If you have many calls to the same
asm routine or subprogram, you'll
use less memory if you set
variables and GOSUB to a routine
that performs the CALL instead of
having the CALL "in line". CALL is
much faster using variables than
using "literals".
CALLS QB 4 When CALLS (note the "S") is used and you
compile with "/D" (debug), the segment of
of a string element descriptor does not get
passed on the stack. In other words, if you
have an assembly language subroutine that
uses CALLS, you should not compile with "/d".
CHAIN QB 4 Unreliable when using DOS 2.x.
CIRCLE QB 4 The start and end angles must be
LESS than 2*pi. Previously they could
be less than or equal to.
CLEAR,,Size QB 3,4 If you receive an out of stack
space message. The stack size is
not reset between CHAIN'ing but if
you CHAIN back to your original
program, be sure to skip the CLEAR
instruction.
COMMON and QB 2-4 All statements that use COMMON or variations
COMMON SHARED thereon with CHAIN must use parameter lists
that match exactly. Best done with $Include.
COMMON with TYPE
QB 4 The TYPE statement must appear before
the COMMON statement and must appear in
all programs that use it. The COMMON
statement must contain "AS". See sample
program #1 at the end of this file.
Compile to EXE QB 4 QB issues an unusual LINK command in the
form of:
LINK Prog+YourLib.Lib;
This causes LINK to bring the entire
library into your program! The solution is
to exit QB, and run BC and LINK yourself.
CONST QB 4 Must be included in all program modules
that use the constant. Place in the file
at the top, rather than inside SUB's.
DATA QB 4 When a DATA statement is encountered inside
a SUB...END SUB structure, QB moves it
into the "mainline" portion of the code when
you are in the environment.
DEF FN All Functions are local to the module
in which the DEF FN appears. Use
QB 4's FUNCTION..END FUNCTION for
global functions.
DIM QB 4 Static numeric arrays are stored on the
"heap" when you are inside the QB 4
environment. BC programs store them in the
default DS.
DIM (TYPE) QB 4 See sample program #1 for dimensioning
arrays of TYPE'd variables.
Division All Using integer division "\" when an
integer result is desired is much
faster than normal division "/".
DRAW QB 2-4 Does not respect the boundaries designated
by WINDOW.
FRE(-1) QB 4 If a Quick Library is loaded, this value
may return incorrectly. QB 4 seems to
forget that the library is loaded and
thinks that the space is available. But,
QB 4 won't let you use the space for
dynamic arrays.
FRE("") QB 4 Using BRUN gives approximately 4K more
than BCOM.
FUNCTION QB 4 Provides global functions for all
modules in a program. All that is
needed is a DECLARE statement in
any module that needs to use the
function. In addition, this type
of function can be recursive. See DEF FN.
FUNCTION QB 4 Cannot be used in $Include files.
IF..THEN..ELSE QB 3 More than two nestings for ELSE on a single
line will not compiler properly.
HEX$ QB 4 Be careful when using with non-integer
values. For example, the output from
the two lines shown is "FFFF8002".
E&=&H8002
PRINT HEX$(E&)
LINK All Use the /EXEPACK switch to condense the
file. Can be used on any program except
programs that are CHAIN'ed to using
all compilers except QB 4. All QB 4
programs can use this switch. Syntax:
LINK /EXE Progname (etc.)
LINK QB 4 When building a Quick Library, be sure
to specify BQLB40 in the library field. Example:
LINK /QU ObjMods,Lib,,BQLB40;
LOAD QB 4 If you receive an "out of memory"
error, try breaking your program
into logical pieces (using
subprograms). Then use COMMON
SHARED for all variables that you
need in the entire program. The
exact same COMMON SHARED
declaration must appear in all the
modules in the program that need
access to the variables.
LOAD QB 4 If you download a QB 4 program in "fast load"
format, many modem transfer protocols
pad the file out using a number of
CHR$(0)'s. This will cause QB 4 to
crash when you attempt to load the program.
Use DEBUG to view the file, then write
the program to disk after changing the
CX register to shorten the length of the
file so that the trailing CHR$(0)'s are
not included. The other solution is to
download this type of file using an ARC
program that restores the original length
of the file.
ON ERROR QB 2-4 Error handler routines must be located
outside SUB...END SUB structures. You
can RESUME to a line number/label that
is outside SUB...END SUB structures
(using /E) or to code inside the sub
using plain RESUME or RESUME
NEXT (/X). Much better is to $Include
subroutines that perform error trapping
instead of having them in subprograms.
This allows the use of RESUME line number/
label and avoids the /X.
OPEN All With Novell NetWare, using OPEN on a file that
does not exist does not always create the file.
Novell has acknowledged the problem but no
solution is available as of 12/19/87.
Overflow All BASIC uses integer types for all
calculations and processes the
right side of the equal sign
before the left side. To force
BASIC to use a different numeric
type, place a type identifier on
the right of the equal sign.
Example: A=Peek(2)+256!*Peek(3)
RESUME All If you always use RESUME
or RESUME