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,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8e64f4db20d57eb5 X-Google-Attributes: gid103376,public From: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: Call by reference vs. call by value Date: 1996/07/22 Message-ID: #1/1 X-Deja-AN: 169597865 references: <31F10E50.726@egr.uri.edu> <31F39035.41C67EA6@swl.msd.ray.com> organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada Date: 1996-07-22T00:00:00+00:00 List-Id: Karl asks "This is really a C or C++ issue, but I still am not sure I understand. I seem to remember passing arrays as function parameters in both C and C++. Since an array reference is always implemented with a pointer in C and C++, all such passing is pass by reference. Why then do you say you can't pass arrays anyway?" You can pass a pointer *by value* in either C or Ada or C++, but this is NOT a call by reference. You can pass a *pointer* to an array, but not an array itself in C, but in Ada you can pass either a pointer to an array (which obviously has reference semantics at the array abstraction level, even though it is a call by value), OR you can pass an array. It is when an array is passed, something you cannot do in C, that the problem arises. Why not just go to the C model of passing pointers around? you might ask! The trouble with this approach is it requires far more aliasing than is comfortable in a language of this class. \