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,FREEMAIL_FROM, 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-13 12:20:46 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!uwm.edu!rpi!not-for-mail From: Hyman Rosen Newsgroups: comp.lang.ada,comp.lang.c++.moderated Subject: Re: C bug of the day Date: 13 Jun 2003 15:22:57 -0400 Organization: KBC Financial Products Sender: cppmods@netlab.cs.rpi.edu Message-ID: <1055510119.45600@master.nyc.kbcfp.com> References: <1054751321.434656@master.nyc.kbcfp.com> NNTP-Posting-Host: netlab.cs.rpi.edu X-Original-Date: Fri, 13 Jun 2003 09:15:11 -0400 X-Submission-Address: c++-submit@netlab.cs.rpi.edu X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated iQBVAwUAPuokjUHMCo9UcraBAQHx8gH/aF9wVHp1ZqvrEy8W5pjYXUP6e+QyzVJi Ri6GByzTfhfAy1N3Vvu/PQJofdge39g6gApte6JnaDwfX0OpevCAww== =6VVl Xref: archiver1.google.com comp.lang.ada:39140 comp.lang.c++.moderated:68312 Date: 2003-06-13T15:22:57-04:00 List-Id: James Rogers wrote: > Another way to ask that is when is initialization a bad thing? The most common case is when you have large arrays which are eventually going to be full of data which requires a bunch of computation to derive. There's no point, and possibly significant delay, in filling them with initial values, say zeroes. In the past, I've also posted a data structure which requires accessing uninitialized data in order to fulfill its time complexity requirements, and yet works (as long as an uninitialized variable can be assumed to hold a definite but unspecified value. That's not true for Standard C++, but many compilers will act that way.) It's a pair of arrays of unsigned integers and a counter for which we want to check if 'd[s[i]] == i' for 's[i] < n'. We can leave 's' to be uninitialized and only set those values we need (i.e., for "interesting" values of 'i'). [ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ] [ about comp.lang.c++.moderated. First time posters: do this! ]