From 6384685114368183947
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,75a9ad8b6ce88ef7
X-Google-Attributes: gidf78e5,public
From: Tom.Horsley@worldnet.att.net (Thomas A. Horsley)
Subject: Re: new class initializer syntax?
Date: 1997/01/31
Message-ID: <ubua6zjfx.fsf@worldnet.att.net>#1/1
X-Deja-AN: 213550050
references: <upvypkzc9.fsf@worldnet.att.net>
x-original-date: 30 Jan 1997 21:07:14 -0500
organization: AT&T WorldNet Services
x-auth: PGPMoose V1.1 PGP comp.std.c++
newsgroups: comp.std.c++
originator: austern@isolde.mti.sgi.com


>Now: What should the copy constructor do with the omitted count?

I'm not sure how those examples are relevant to default initializers. I
can screw things up exactly the same way with or without a default
initializer :-). The answer in my proposal is:

>2. Initialize with 0 (like the other constructors do)
...
>while 2 would easily lead to nasty bugs as soon as someone gets used to
>omit initializers on constructors

The problem is that initializers *already* get omitted quite frequently.
Just because it is possible to contrive an example in which the default
initializer doesn't help doesn't mean there aren't examples where it does
help.

Actually, as an alternate proposal, I'd be perfectly happy if the language
simply made it an error to provide a constructor which does not *explicitly*
initialize each member (as long as there was a way to say "this member is
explicitly NOT initialized"). But I bet such a change would upset a tad
more people that providing a default initializer would :-). (Hmmm... maybe
we can add a compiler option to do this...).
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]



