Re: "static" question

From: Alf P. Steinbach (alfps_at_start.no)
Date: 04/18/04


Date: Sun, 18 Apr 2004 14:04:51 GMT


* "Pat" <Pat@Pat.com> schriebt:
> I would like to know what is the meaning of :
>
> static vector<int> v;
>
> What is the difference with:
>
> vector<int> v;
>

That depends on the context of the declaration.

If it is at namespace scope (outside any function or class) then 'static'
means that v has internal linkage, i.e., in practical terms, is not visible to
the linker outside the compilation unit.

If it is in a class or function then 'static' means that v has global
lifetime; for a class it is a single variable instead of a member variable in
each instance of the class; for a function it is a single variable instead of
an automatic variable created & destroyed for each call of the function.

-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?


Relevant Pages

  • Re: On the Militia of the US Constitution
    ... Specifically, the meaning of ... of territory occupied by the political societies within ... Thus the meaning of "the people" in the context of the ... Justice Story just showed you that the context determines the ...
    (talk.politics.guns)
  • Re: General remarks on restrict
    ... qualification *does* carry a meaning for the human programmer who uses ... This means that a function type with restrict-qualified parameters is compatible with a similar function type that declares the parameters without the restrict qualifier. ... In a C program, the names and qualifiers of parameters in a function declaration are meaningless, in the sense that a compatible definition is free to declare the parameters with different names and qualifiers, and any semantics associated with qualifiers depend on the qualifiers used in the definition, not the ones used in the declaration. ... Does the standard say anywhere that the qualifiers in the synopsis of a standard library function carry more meaning than they do in an identically looking declaration in a C program? ...
    (comp.std.c)
  • Re: Of win64 and pets
    ... >> A multiplicity of contexts does not mean a multiplicity of meanings within ... do take the concept of a single unified meaning for granted. ... it remains relatively pointless to argue that each context ... The state of unknowability would be a case where there is "fundamental ...
    (borland.public.delphi.non-technical)
  • Re: A DECLARATION OF MEANING
    ... > is just a declaration of meaning and not a thesis. ... If we define fitness as being that which is maximised by the action of ... Note that John Edser wrote: ...
    (sci.bio.evolution)
  • Re: Basic data definitions
    ... Thank you Anith. ... > Information can be defined as, knowledge that, within a certain context, has ... > In the context of databases, schema stands for the entire or some subset of ... since data implies meaning or informational ...
    (microsoft.public.sqlserver.programming)