All,

Anyone have any suggestions for completing the last line below:

public/private define a variable's scope.
int/char/double define a variable's type.
static/non-static define a variable's ____________.

I know what static variables are, I just can't think of a word or even 2 words to fill in the blank. (I'm building a symbol table and I need a pidgeon hole for the "static" keyword.)

Thanks,
-Bill

Recommended Answers

All 4 Replies

persistence

Excellent! Thank you!

-Bill

storage

In formal terms, "static" is a storage-class specifier.

storage
In formal terms, "static" is a storage-class specifier.

That doesn't uniquely define static though. There are other storage class specifiers, and data types in general can be described as partially defining a variable's storage attributes.

Unfortunately, persistence doesn't quite cut it either if we're talking about a language like C++ because the static keyword is overloaded to mean different things. At file scope, static would be better described as defining a variable's visibility. As a static class member, a better description might be to define a variable as shared between objects of the class. At function scope, persistence is an excellent choice of words.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.