From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,HEADER_SPAM autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b30bd69fa8f63cb2 X-Google-Attributes: gid103376,public X-Google-Thread: fc772,b30bd69fa8f63cb2 X-Google-Attributes: gidfc772,public X-Google-ArrivalTime: 2003-06-14 17:43:05 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!uwm.edu!rpi!not-for-mail From: =?Windows-1252?Q?Terje_Sletteb=F8?= Newsgroups: comp.lang.ada,comp.lang.c++.moderated Subject: Re: C bug of the day Date: 14 Jun 2003 20:45:17 -0400 Organization: unknown Sender: cppmods@netlab.cs.rpi.edu Message-ID: References: NNTP-Posting-Host: netlab.cs.rpi.edu X-Original-Date: Sat, 14 Jun 2003 14:01:17 +0200 X-Submission-Address: c++-submit@netlab.cs.rpi.edu X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated iQBVAwUAPuvBmkHMCo9UcraBAQEpiQH/St5CiZ7kdQM6eaj8NGVMfCeASBm2tZxj FgVZU94sHSbag2sLfU1QdkqRpsx4cNOd/ASLmlC7/Yj1hPzHGvoUqg== =zLUu Xref: archiver1.google.com comp.lang.ada:39189 comp.lang.c++.moderated:68376 Date: 2003-06-14T20:45:17-04:00 List-Id: "Dave Harris" wrote in message news:memo.20030613191305.38347A@brangdon.madasafish.com... > jimmaureenrogers@att.net (James Rogers) wrote (abridged): > > If your suggestion was adopted, how would it affect existing > > programs? > > Some currently non-portable ones would become well-behaved. > > > why would you ever *want* uninitialized variables? > > Mainly for speed. We would want to be able to say, eg, > std::vector vec( 1000000, unitialised ); > > to avoid writing a million zeros. Which I suspect makes it a non-trivial > language change. What is the type of "initialised"? You could always have an overloaded constructor, with a "tag" type (as suggested in the "using named parameters separators" thread at comp.std.c++): enum uninitialised_type { uninitialised }; std::vector constructor: vector(size_t size, uninitialised_type); // Performs uninitialised construction Not a non-trivial language change, at all. Just a library change. An implementation may well optimise away the tag value passing, seeing that it's not used. Regards, Terje [ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ] [ about comp.lang.c++.moderated. First time posters: do this! ]