From 3136862880623046362 X-Google-Thread: f78e5,e2cfdf64f67c7793 X-Google-Attributes: gidf78e5,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!atl-c02.usenetserver.com!news.usenetserver.com!peer01.cox.net!cox.net!news-hub.cableinet.net!blueyonder!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull From: usenet-nospam@nmhq.net (Niklas Matthies) Newsgroups: comp.std.c++ Subject: Re: Eliminating uninitialised variables Date: Mon, 25 Oct 2004 18:22:52 GMT Organization: Avonlea Village Improvement Society Lines: 37 Sender: mail2news@demon.net Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++) Message-ID: References: NNTP-Posting-Host: news.news.demon.net X-Trace: news.demon.co.uk 1098728602 19492 158.152.254.254 (25 Oct 2004 18:23:22 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Mon, 25 Oct 2004 18:23:22 +0000 (UTC) X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov) X-User-Agent: slrn/0.9.8.0 (FreeBSD) X-Orig-X-Trace: news.uni-berlin.de zvVRKhqtd/pudV/0C9MROgb99uUiUYmqfXEvD9OPdr0+TLPVI= X-Virus-Scanned: by amavisd-new at cs.mu.OZ.AU X-Reply-To: usenet-reply at nmhq dot net X-Received: (from fjh@localhost) by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id i9PIMqFI014408; Tue, 26 Oct 2004 04:22:52 +1000 (EST) X-Path: comp-std-cpp-robomod!not-for-mail X-Delivered-To: std-c++@ucar.edu X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f X-Newsgroups: comp.std.c++ Xref: g2news1.google.com comp.std.c++:3159 On 2004-09-21 05:24, Dave Harris wrote: : > The efficiency issue we can probably handle by providing a way to request > uninitialised variables explicitly. Eg reusing the keyword "void": > int x; // x is 0. > int y = void; // y is uninitialised. > > The important cases are arrays: > int array[1000] = void; > > especially when they are instance variables: > > struct S { > int array[1000]; > S() : array(void) {} > }; > > I'm not wedded to this particular syntax. I'd suggest '?' (question mark) instead of 'void'. E.g.: int x = ?; struct S { int array[1000]; S() : array(?) { } }; -- Niklas Matthies --- [ 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.jamesd.demon.co.uk/csc/faq.html ]