Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

In compiler design, a variable-length name is stored using space suited to the name’s actual characters, rather than reserving the same fixed-size slot for every name. A symbol table can keep the names in a character sequence and record each name’s starting position and length. This describes a storage layout—not a rule that identifiers in a programming language can be infinitely long.

How variable-length name storage works

A compiler’s symbol table keeps information about names used in a program. In one variable-length layout, names are placed consecutively in a character sequence. For each name, metadata records where it starts and how many characters it contains. The compiler can use those two values to locate the name and determine where it ends.

For example, the compiler-design notes illustrate the method with the names Calculate, sum, a, and b. Each name occupies space according to its spelling, while its starting index and length identify its position in the sequence. The index and length are illustrative values, not a benchmark or a measured result. Compiler-design notes on symbol-table storage

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How it differs from fixed-length storage

Aspect Fixed-length names Variable-length names
Space for each name A fixed-size slot is reserved for every name, regardless of its actual length. Names occupy space according to their characters.
How the name is located The slot’s fixed size determines its position. Metadata can record the name’s starting index and length.
What the example establishes A contrasting storage layout. A character-sequence layout with index-and-length metadata; no quantified speed or memory advantage is established.

These are alternative representation choices. The description alone does not show which is faster or uses less memory in a particular compiler; that would depend on implementation and measurement.

Does this mean identifiers have no length limit?

No. “Variable-length” here describes how names can be represented in storage. Programming languages separately define which spellings are valid, whether names are case-sensitive, which names are reserved, and whether a maximum length applies. Those rules vary by language and sometimes by configuration. C identifier guidance, for example, is specific to C rather than a general rule for all languages. Yale CPSC 223 notes on C names

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why the language and setting matter: a SAS example

The SAS 9.3 reference illustrates how identifier limits can depend on both a product version and a setting. Under VALIDVARNAME=V7, SAS variable names may be up to 32 characters. Under VALIDVARNAME=ANY, a broader character set is allowed and the limit is 32 bytes. These are SAS 9.3 rules, not general limits for compiler symbol tables or programming-language identifiers. SAS 9.3 reference on variable names

Quick Recap

What to remember

  • A variable-length name representation stores names according to their actual string length.
  • A symbol table can identify each stored name with its starting position and length.
  • Storage representation does not determine the source language’s identifier rules or maximum length.
  • When discussing a limit, specify the language or product, version, setting, and whether the limit is measured in characters or bytes.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.