Topic: Defect Report: Erroneous restrictions on variables which can
Author: musiphil@bawi.org (Seungbeom Kim)
Date: Tue, 20 Feb 2007 03:11:00 GMT Raw View
whyglinux wrote:
> 8.5 Initializers[dcl.init], paragraph 2 reads,
>
> "Automatic, register, static, and external variables of namespace
> scope can be initialized by arbitrary expressions involving literals
> and previously declared variables and functions."
>
> Both automatic and static are used to describe *storage durations*,
> register is a *storage class specifier* which indicates the object has
> automatic storage duration, external describes *linkage*, and
> namespace scope is a kind of *scope*. Automatic, register, static and
> external, together with namespace scope, are used to restrict the
> "variables".
I guess the statement is meant to be parsed as: "(Automatic), (register),
(static), and (external variables of namespace scope) can be initialized
." Yes, it is tricky and would be better if rephrased.
>
> Register objects are only a sub-set of automatic objects and thus the
> word "register" is redundant and should be elided. If register objects
> are to be emphasized, they should be appeared like "Automatic
> (including register)..."
Basically agreed.
>
> [...]
>
> As a result, the erroneous restrictive "automatic, register, static"
> should be removed and the quoted sentence may be changed to:
>
> External variables of namespace scope can be initialized by arbitrary
> expressions involving literals and previously declared variables and
> functions.
The original sentence is not that erroneous, as long as it is parsed in
a different way. Your new statement means something more restrictive
than the original. Maybe it could be made to classify variables based
only on storage duration; it's not very clear what "static variables"
really mean, and I'm not sure if the sentence really meant to exclude
static member variables (which also has a static storage duration). I
would prefer "Variables of automatic or static storage duration can be
.", as long as it is consistent with what the committee really meant.
--
Seungbeom Kim
---
[ 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.comeaucomputing.com/csc/faq.html ]