Topic: Definition of "storage class
Author: allan_w@my-dejanews.com (Allan W)
Date: Fri, 31 Jan 2003 16:12:02 +0000 (UTC) Raw View
> > SO ... the answer is that these two terms are related, but not
> > synonymous. For instance, an object with "register" storage class
> > also has "automatic" storage duration.
musiphil@bawi.org (KIM Seungbeom) wrote
> You also mentioned "'register' storage class" - did you mean
> "'register' storage duration," or something different?
There are only three types of "storage duration." There are five
"storage class specifiers." Obviously there is not a one-to-one
correlation.
Three ways to give a variable "automatic" storage duration:
Use the "register" storage specifier
Use the "auto" storage specifier
Don't use any storage specifier (within a statement block)
Two ways to give a variable "static" storage duration:
Use the "static" storage specifier
Use the "extern" storage specifier
One way to give a variable "dynamic" storage duration:
Create it in a new-expression.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: kanze@gabi-soft.de (James Kanze)
Date: Mon, 3 Feb 2003 15:56:15 +0000 (UTC) Raw View
allan_w@my-dejanews.com (Allan W) wrote in message
news:<7f2735a5.0301301728.49e96d7d@posting.google.com>...
> There are only three types of "storage duration." There are five
> "storage class specifiers." Obviously there is not a one-to-one
> correlation.
> Three ways to give a variable "automatic" storage duration:
> Use the "register" storage specifier
> Use the "auto" storage specifier
> Don't use any storage specifier (within a statement block)
> Two ways to give a variable "static" storage duration:
> Use the "static" storage specifier
> Use the "extern" storage specifier
Or don't use any storage specifier (at namespace scope).
> One way to give a variable "dynamic" storage duration:
> Create it in a new-expression.
--
James Kanze mailto:jkanze@caicheuvreux.com
Conseils en informatique orient e objet/
Beratung in objektorientierter Datenverarbeitung
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: musiphil@bawi.org (KIM Seungbeom)
Date: Tue, 28 Jan 2003 19:05:58 +0000 (UTC) Raw View
Allan W wrote:
>
> musiphil@bawi.org (KIM Seungbeom) wrote
> > I wonder if the term "storage class" is defined in the standard;
> > the index says it's on page 21, but I cannot find it there.
> >
> > If it is not formally defined, am I correct to say that it is an
> > informal term which has the same meaning as "storage duration?"
>
> SO ... the answer is that these two terms are related, but not
> synonymous. For instance, an object with "register" storage class
> also has "automatic" storage duration.
Thanks.
I knew the difference and relationship between "storage duration" and
"storage class specifier," but didn't know what "storage class" meant.
In a Korean newsgroup, someone maintained that it was a concept
closely related to, but different from storage class specifiers and
storage duration, while I suggested that though it was not formally
defined in the standard, it was used on the whole in nearly the same
meaning as storage duration.
You also mentioned "'register' storage class" - did you mean
"'register' storage duration," or something different?
--
KIM Seungbeom <musiphil@bawi.org>
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: allan_w@my-dejanews.com (Allan W)
Date: Mon, 27 Jan 2003 22:57:25 +0000 (UTC) Raw View
musiphil@bawi.org (KIM Seungbeom) wrote
> I wonder if the term "storage class" is defined in the standard;
> the index says it's on page 21, but I cannot find it there.
>
> If it is not formally defined, am I correct to say that it is an
> informal term which has the same meaning as "storage duration?"
Clearly the index is wrong -- page 21 does not use that phrase.
The "storage class specifiers" are given in 7.1.1/1 and repeated
in A.6:
auto register static extern mutable
and at most one can be used.
The three types of "storage duration" are given in 3.7/1:
static automatic dynamic
3.7/3 says that two of the "storage class specifiers," auto and static,
are "related to storage duration."
SO ... the answer is that these two terms are related, but not
synonymous. For instance, an object with "register" storage class
also has "automatic" storage duration.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: musiphil@bawi.org (KIM Seungbeom)
Date: Fri, 24 Jan 2003 20:19:53 +0000 (UTC) Raw View
I wonder if the term "storage class" is defined in the standard;
the index says it's on page 21, but I cannot find it there.
If it is not formally defined, am I correct to say that it is an
informal term which has the same meaning as "storage duration?"
Thanks in advance.
--
KIM Seungbeom <musiphil@bawi.org>
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]