Article ID: 36737 - Last Review: November 21, 2006 - Revision: 1.2

Longer Variable Names Take No Extra Space in .EXE Program

This article was previously published under Q36737
Expand all | Collapse all

SUMMARY

In programs compiled by BC.EXE, you will not change the generated code size by using shorter variable names instead of longer ones. The generated .OBJ and .EXE file sizes are independent of the length of variable names.

Although BC.EXE uses variable names at compile time to allocate memory and translate Basic statements to machine code, these symbolic names are not embedded in the code produced by the compiler.

This information applies to Microsoft QuickBasic Versions 1.00, 1.01, 1.02, 2.00, 2.01, 3.00, 4.00, 4.00b, and 4.50; to Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS and MS OS/2; and to Microsoft Basic PDS Version 7.00 for MS-DOS and MS OS/2.

MORE INFORMATION

Source code can be much more readable if you use fully-descriptive names in naming variables. QuickBasic allows variable names up to 40 characters in length. Consider the following choices of variable names:
   mfp     versus      MeanFreePath
   n$      versus      LastName$
   vo      versus      Volts
   vl      versus      Volume
   vc      versus      Velocity
				
The names in the right column generate no more code than those on the left side.

However, within the QB.EXE program development environment, all text in the source file occupies memory, including long variable names.

APPLIES TO
  • Microsoft QuickBasic 1.0
  • Microsoft QuickBasic 1.01
  • Microsoft QuickBasic 1.02
  • Microsoft QuickBasic 2.0
  • Microsoft QuickBasic 2.01
  • Microsoft QuickBasic 3.0
  • Microsoft QuickBasic 4.0
  • Microsoft QuickBASIC 4.0b
  • Microsoft QuickBasic 4.5 for MS-DOS
  • Microsoft BASIC Professional Development System 7.0
  • Microsoft BASIC Compiler 6.0
  • Microsoft BASIC Compiler 6.0b
Keywords: 
KB36737
Retired KB ArticleRetired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
 

Article Translations