From -4884082939836735678
X-Google-Thread: f78e5,18fc1ba006434378
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII
Path: g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.speakeasy.net!news.speakeasy.net.POSTED!not-for-mail
NNTP-Posting-Date: Tue, 08 May 2007 08:40:11 -0500
Return-Path: <devnull@stump.algebra.com>
X-Authentication-Warning: mulga.csse.unimelb.edu.au: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Original-To: std-c++@mailman.ucar.edu
Delivered-To: std-c++@mailman.ucar.edu
From: =?iso-8859-1?q?Daniel_Kr=FCgler?= <daniel.kruegler@googlemail.com>
Newsgroups: comp.std.c++
Subject: Re: Class member initializers in class declaration
Organization: http://groups.google.com
Message-ID: <1178606485.707432.301950@e51g2000hsg.googlegroups.com>
References: <1178316376.380533.96220@w5g2000hsg.googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Complaints-To: groups-abuse@google.com
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: e51g2000hsg.googlegroups.com; posting-host=195.137.177.243;
   posting-account=0YhmiQ0AAABRDjD_6coNmBVB3rgPlaOq
X-Virus-Scanned: amavisd-new at ucar.edu
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by mulga.csse.unimelb.edu.au id l486fpTm004824
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
Date: Tue,  8 May 2007 08:39:30 CST
Lines: 50
NNTP-Posting-Host: 65.182.171.162
X-Trace: sv3-rGPsDWc5SDoY7haq2c5KPDs5/HA+KY63thlt3kyQkYc6+7LBISNgAqESivWPyQ0hEyTzoBp4FQZ4YML!omiBd+Azo+EljeS4bzx32VgZdPu5ad0DzYgovJYKCiRH0Mv9fwwPqgAAefYj0/x9FikDB2W4Sf69!1V6z6Zc/R0WWBKKnIb25qmu5BiTYDrkkzFY9MLLkgdg=
X-Complaints-To: abuse@speakeasy.net
X-DMCA-Complaints-To: abuse@speakeasy.net
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.34
Xref: g2news1.google.com comp.std.c++:8578


===================================== MODERATOR'S COMMENT: 
 Apologies for any delays in moderation; this appears to be
caused by my ISP (Cox) dropping and/or blocking e-mail.


===================================== END OF MODERATOR'S COMMENT
On May 8, 5:11 am, bina...@gmail.com wrote:
> Initializers in the class declaration should come after initializers
> in the constructor, but before the constructor definition.
> Effectively, a compiler could append initializers in the class
> definition to those in the constructor.  All the rules about
> initializers on a constructor would apply here as well.  If a variable
> is initialized in both places, the one in the constructor should take
> precedence.

This proposal definitely contradicts the life-time model of
C++. 12.6.2 describes the order of initialization (and
destruction) of bases and members. One very important
paragraph is 5, here I quote only the last two bullets:

"[..]
- Then, nonstatic data members shall be initialized in the
order they were declared in the class definition (again
regardless of the order of the mem-initializers).
- Finally, the body of the constructor is executed."

Implementing your idea would cause severe problems,
because member initialization can depend on each
other in the above described ordering. Your proposal
changes this ordering and we have one more
(inconsistent) rule to remember.

This point has also impact on the order of destruction
of fully constructed subobjects of partially constructed
or destructed objects under exceptional situations, see
15.2/2.

Greetings from Bremen,

Daniel Kr�gler



---
[ 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                      ]



