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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1116ece181be1aea X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-07 23:56:39 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!small1.nntp.aus1.giganews.com!nntp.giganews.com!cyclone1.gnilink.net!spamkiller2.gnilink.net!nwrdny02.gnilink.net.POSTED!53ab2750!not-for-mail From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030901 Thunderbird/0.2 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Counter-proposal for variable arrays References: <834clb.uan1.ln@skymaster> <3F79EF18.7060600@comcast.net> <3F7B1076.8060106@comcast.net> <5mknnv4u96qqudrt4bd8n4t1cljp2fjlp8@4ax.com> <1065215180.95094@master.nyc.kbcfp.com> <19p2ovk1jh4krn2h5cql44p37ovf6va99i@4ax.com> In-Reply-To: <19p2ovk1jh4krn2h5cql44p37ovf6va99i@4ax.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Wed, 08 Oct 2003 06:56:37 GMT NNTP-Posting-Host: 162.83.244.79 X-Complaints-To: abuse@verizon.net X-Trace: nwrdny02.gnilink.net 1065596197 162.83.244.79 (Wed, 08 Oct 2003 02:56:37 EDT) NNTP-Posting-Date: Wed, 08 Oct 2003 02:56:37 EDT Xref: archiver1.google.com comp.lang.ada:442 Date: 2003-10-08T06:56:37+00:00 List-Id: Dmitry A. Kazakov wrote: > Mmm I guess array is something that one can pass as a parameter. For > example: > void Erase (char X [20]) > { > memset (X, 0, sizeof (X)); // How many element will be set? > } For C compatibility, C++ arrays have the same decay-to-pointer semantics in many circumstances. To prevent this, simply use a reference: void Erase (char (&X)[20]) { memset(X, 0, sizeof(X)); } >>Yeah. So what? What exactly would the implementation of an array of >>class-wide elements look like, anyway? > > Children_And_Pop_Up_Array : > Container > ( 1..20, -- Constrain the bounds > From => Child_Window'Tag, -- Constrain the elements > To => Pop_Up_Window'Tag > ); > > The array contains 20 elements of types between Child_Window and > Pop_Up_Window. Note that because all possible types are known, the > upper bound of the element size is also known. So the array could be > allocated as usual. This seems like a pretty specialized usage to me, not particularly worthy of dedicated language support. For one thing, classwide types are there to support object-oriented programming, where you don't know at the declaration point what types will be used. For your purpose above, can't you just use an array of variant records instead?