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 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 02:35:11 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed.news.qwest.net!namche.sun.com!news1brm.central.sun.com!new-usenet.uk.sun.com!not-for-mail From: Ole-Hjalmar Kristensen Newsgroups: comp.lang.ada Subject: Re: Counter-proposal for variable arrays Date: 07 Oct 2003 11:23:39 +0200 Organization: Sun Microsystems Message-ID: 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> NNTP-Posting-Host: khepri06.norway.sun.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: new-usenet.uk.sun.com 1065518620 23789 129.159.112.195 (7 Oct 2003 09:23:40 GMT) X-Complaints-To: usenet@new-usenet.uk.sun.com NNTP-Posting-Date: 7 Oct 2003 09:23:40 GMT User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:366 Date: 2003-10-07T09:23:40+00:00 List-Id: >>>>> "PO" == Pascal Obry writes: PO> Hyman Rosen writes: >> C++ has arrays. PO> No it has pointers. >> Making obviously wrong statements about C++ is silly. PO> I can send you the same compliment! Or maybe we have a different definition PO> of array. PO> char ptr1[156]; PO> char ptr2[156]; PO> ptr1 = ptr2; PO> Just copy the "pointer" ptr2 to ptr1. That's my point. Array is not a first PO> class citizen in C++, just "emulated" with pointers. To pass such "array" into PO> a procedure you can say: It would be a good idea to check your facts before posting. Arrays are *constant* pointers, so the assignment above will not compile. But I agree that arrays are not first class citizens in C/C++. The relationship with pointers is obvious if you look at the following relationship, which always holds: x[13] == *(x+13) == *(13+x) == 13[x] !!!! PO> void proc (char *ptr); PO> And into ptr you can pass objects such as: PO> ptr1 PO> new char[12] Yes, there is no range check, just like Fortran. PO> "whatever" Yes, like Ada, C strings are arrays of characters :-) PO> Call this array if you like. I do, the C array is essentially the same as early Fortran, and being brainwashed by the Univac Fortran compiler at an early age, I cannot see why this is not an array. You just have to keep track of the bounds yourself. PO> Pascal. PO> -- PO> --|------------------------------------------------------ PO> --| Pascal Obry Team-Ada Member PO> --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE PO> --|------------------------------------------------------ PO> --| http://perso.wanadoo.fr/pascal.obry PO> --| "The best way to travel is by means of imagination" PO> --| PO> --| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595 -- This page intentionally left blank