Re: "static" question
From: Pat (Pat_at_Pat.com)
Date: 04/19/04
- Next message: Pat: "C++ container question"
- Previous message: Siemel Naran: "Re: create a variable name with the value of another variable"
- In reply to: Alf P. Steinbach: "Re: "static" question"
- Next in thread: Fraser Ross: "Re: "static" question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 20 Apr 2004 00:31:36 +0800
Thanks, Alf.
Pat
"Alf P. Steinbach" <alfps@start.no> ¦b¶l¥ó
news:408289ff.369713562@news.individual.net ¤¤¼¶¼g...
> * "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?
- Next message: Pat: "C++ container question"
- Previous message: Siemel Naran: "Re: create a variable name with the value of another variable"
- In reply to: Alf P. Steinbach: "Re: "static" question"
- Next in thread: Fraser Ross: "Re: "static" question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|