Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail |
|---|---|
| From | jgk@panix.com (Joe keane) |
| Newsgroups | comp.std.c++ |
| Subject | Re: Re: Request för std::vector and possibly others: minimal initalization |
| Date | Tue, 27 Mar 2012 12:10:06 -0700 (PDT) |
| Organization | Public Access Networks Corp. |
| Lines | 32 |
| Sender | std-cpp-request@vandevoorde.com |
| Approved | stephen.clamage@oracle.com |
| Message-ID | <jkql5v$mbm$1@reader1.panix.com> (permalink) |
| References | <abf103e0-7005-47b4-9888-af946353a525@v22g2000vby.googlegroups.com> <3008757.1215.1332274822853.JavaMail.geo-discussion-forums@pbjv6> <b94ffa35-1289-4a00-b9fd-92a56dfee459@w32g2000vbt.googlegroups.com> |
| NNTP-Posting-Host | 6mOQXIdsHrUo5umfs3dbHYUJ4MeAJa/GV3AhRK1gaxk= |
| X-Trace | news.albasani.net 05YJn3WS/EIXe+7Rr7LZdmNpHwezQaC3zWiKVPfl9lwnXpE5F31Jd/MlFvbpgOJVAOYT+uifZfBdDY8Mlwl51A== |
| X-Complaints-To | abuse@albasani.net |
| NNTP-Posting-Date | Tue, 27 Mar 2012 19:10:07 +0000 (UTC) |
| X-Mailer | Perl5 Mail::Internet v2.05 |
| X-Submission-Address | std-cpp-submit@vandevoorde.com |
| Cancel-Lock | sha1:m3BhwPe/8KYxodpoVXohms7vaTM= |
| X-Original-Date | Mon, 26 Mar 2012 20:56:31 +0000 (UTC) |
| Xref | csiph.com comp.std.c++:471 |
Show key headers only | View raw
In article<b94ffa35-1289-4a00-b9fd-92a56dfee459@w32g2000vbt.googlegroups.com>,
henrikv<henrik.vallgren@stream-space.com> wrote:
>struct NoInitDummy
>{
> NoInitDummy() {}
>
> // Make this behave like a Dummy using conversion operators etc
> int a;
>};
C++ gives some rules about when things get initialized, which usually
helps you, but sometimes just gets in your way. So then you think, 'you
want the one function to run but not the other one?' and then you're
like 'umm, -yeah-, that's what i want'. So then you think, 'is my
design defective?', or is this a case where C++ has inferred what
behavior you want, when actually that is not the behavior you want.
An example is class Y derives from class X. The way to initialize Y, so
we are told, is to call a function to initialize it so far as being an X
object, then call another function to convert an X object to a Y object.
Sometimes this is awkward. Sometimes the easiest thing to do is to say
'the Y initializer will do everything, and please don't talk to the X
initializer at all'. I don't think that is bad design, it's just where
some of the tacit assumptions in the language go a bit awkward; it's not
saying you *can't* do that, that's what an 'uninit' class is there for.
--
[ comp.std.c++ is moderated. To submit articles, try posting with your ]
[ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Back to comp.std.c++ | Previous | Next — Previous in thread | Next in thread | Find similar
Request för std::vector and possibly others: minimal initalization henrikv <henrik.vallgren@stream-space.com> - 2012-03-19 23:35 -0700
Re: Request för std::vector and possibly others: minimal initalization Francis Glassborow<francis.glassborow@btinternet.com> - 2012-03-21 11:35 -0700
Re: Request för std::vector and possibly others: minimal initalization henrikv<henrik.vallgren@stream-space.com> - 2012-03-23 17:09 -0700
Re: Request för std::vector and possibly others: minimal initalization Daniel Krügler <daniel.kruegler@googlemail.com> - 2012-03-24 19:25 -0700
Re: Request för std::vector and possibly others: minimal initalization Francis Glassborow <francis.glassborow@btinternet.com> - 2012-03-24 19:28 -0700
Re: Request för std::vector and possibly others: minimal initalization Jason McKesson<jmckesson@gmail.com> - 2012-03-21 11:35 -0700
Re: Request för std::vector and possibly others: minimal initalization henrikv<henrik.vallgren@stream-space.com> - 2012-03-23 17:10 -0700
Re: Request för std::vector and possibly others: minimal initalization Jason McKesson<jmckesson@gmail.com> - 2012-03-24 17:55 -0700
Re: Request for std::vector and possibly others: mi brangdon@cix.compulink.co.uk (Dave Harris) - 2012-03-24 19:24 -0700
Re: Re: Request för std::vector and possibly others: minimal initalization jgk@panix.com (Joe keane) - 2012-03-27 12:10 -0700
Re: Request för std::vector and possibly others: minimal initalization Kevin McCarty<kmccarty@gmail.com> - 2012-03-23 17:11 -0700
Re: Request för std::vector and possibly others: minimal initalization Miles Bader<miles@gnu.org> - 2012-03-24 17:55 -0700
Re: Request för std::vector and possibly others: minimal initalization henrikv <henrik.vallgren@stream-space.com> - 2012-03-25 23:14 -0700
Re: Request för std::vector and possibly others: minimal initalization Jason McKesson <jmckesson@gmail.com> - 2012-03-24 19:27 -0700
Re: Request för std::vector and possibly others: minimal initalization Pedro Lamarão<pedro.lamarao@gmail.com> - 2012-03-29 12:28 -0700
Re: Request för std::vector and possibly others: minimal initalization Daniel Krügler <daniel.kruegler@googlemail.com> - 2012-03-29 13:17 -0700
csiph-web