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-08 00:01:55 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!in.100proofnews.com!in.100proofnews.com!cycny01.gnilink.net!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: <3F739C1D.4030907@attbi.com> <3F78E850.8010401@comcast.net> <3F797748.3000203@noplace.com> <834clb.uan1.ln@skymaster> <3F79EF18.7060600@comcast.net> <3F7B1076.8060106@comcast.net> <5mknnv4u96qqudrt4bd8n4t1cljp2fjlp8@4ax.com> <1065215180.95094@master.nyc.kbcfp.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Wed, 08 Oct 2003 07:01:54 GMT NNTP-Posting-Host: 162.83.244.79 X-Complaints-To: abuse@verizon.net X-Trace: nwrdny02.gnilink.net 1065596514 162.83.244.79 (Wed, 08 Oct 2003 03:01:54 EDT) NNTP-Posting-Date: Wed, 08 Oct 2003 03:01:54 EDT Xref: archiver1.google.com comp.lang.ada:443 Date: 2003-10-08T07:01:54+00:00 List-Id: Pascal Obry wrote: > I can send you the same compliment! Or maybe we have a different definition > of array. > char ptr1[156]; > char ptr2[156]; > ptr1 = ptr2; This is illegal in both C and C++, and will compile in neither. > To pass such "array" into a procedure you can say: > void proc (char *ptr); To pass an array and preserve its array type, just use a reference: void proc(char (&array)[156]); Into this you can pass only conformant arrays, not arbitrary char *s. Naturally this would normally be written as a template template void proc(T (&array)[N]); in order to have it work for arbitrary array types and sizes. > Call this array if you like. OK, I will.