Singleton variable

From Wikipedia, the free encyclopedia

In computer programming a singleton variable is a variable that is referred to only once after it has been declared.

Examples of where a variable might only be referenced once is as a dummy argument in a function call, or when its address is assigned to another variable which subsequently accesses its allocated storage.

This usage pattern sometimes occurs because a mistake has been made, with more than one reference being intended. Some compilers and lint-like tools flag occurrences of singleton variables.

[edit] See also

Singleton pattern