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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2cb1f0b6d642e1dc X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!novia!news-xxxfer.readnews.com!news-out.readnews.com!textspool2.readnews.com!s09-10.readnews.com!not-for-mail Date: Mon, 28 Mar 2011 23:01:47 -0400 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Pascal Calling Convention References: <9b04626e-567d-408c-aab3-39b964b3ffd6@l2g2000prg.googlegroups.com> <4d90efdd$1$14806$882e7ee2@usenet-news.net> <330393be-cb82-4cd8-ba44-6e59af7b75bf@v11g2000prb.googlegroups.com> <4d90fd41$1$14782$882e7ee2@usenet-news.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4d914bd4$0$14782$882e7ee2@usenet-news.net> NNTP-Posting-Host: a5489d77.usenet-news.net X-Trace: DXC=JVKUR\7@;d7kB9I=nb1[5?QFZ3T]GPM]7mX0AG3X_jU?JLi22nWOTKLQ3McWTcYQB@P1g60;Ok]oN^>;<9YUG?;JF2 X-Complaints-To: abuse@usenet-news.net Xref: g2news1.google.com comp.lang.ada:18567 Date: 2011-03-28T23:01:47-04:00 List-Id: On 3/28/2011 6:08 PM, Adam Beneschan wrote: > I don't see how any compiler could reasonably > detect that the code is going to read a value that hasn't been set, > given that such reads are reads of array elements using indexes that > aren't known at compile time. If the language rules say it's undefined behavior, I had better not just go ahead and do it anyway, hoping that the compiler won't notice! > On top of that, I don't see why anyone would prefer this over the > trivial structure that just allocates N bytes, initializes them to 0, > and sets a byte to 1 to add an element to the set, etc. That > structure has non-constant initialization, but so what? Aside from the O(1) initialization (which you cannot just dismiss as unnecessary), this structure also provides O(n) (rather than O(N)) iteration over the members. This is actually a question I asked when I used this for interviews - when is this structure better than the straightforward bit-per-member version? The answer is when the typical number of members is much smaller than the maximum number, and indeed that was the situation described by the authors who invented this.