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-Thread: 103376,703c4f68db81387d X-Google-Thread: 109fba,703c4f68db81387d X-Google-Thread: 115aec,703c4f68db81387d X-Google-Thread: f43e6,703c4f68db81387d X-Google-Attributes: gid103376,gid109fba,gid115aec,gidf43e6,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!cyclone1.gnilink.net!spamkiller2.gnilink.net!gnilink.net!trndny06.POSTED!c2bfcbcf!not-for-mail Subject: Re: Teaching new tricks to an old dog (C++ -->Ada) Newsgroups: comp.lang.ada,comp.lang.c++,comp.realtime,comp.software-eng References: <4229bad9$0$1019$afc38c87@news.optusnet.com.au> <1110032222.447846.167060@g14g2000cwa.googlegroups.com> <871xau9nlh.fsf@insalien.org> <3SjWd.103128$Vf.3969241@news000.worldonline.dk> <87r7iu85lf.fsf@insalien.org> <1110052142.832650@athnrd02> <1110284070.410136.205090@o13g2000cwo.googlegroups.com> <395uqaF5rhu2mU1@individual.net> <1110377260.350158.58730@z14g2000cwz.googlegroups.com> Message-ID: From: "Ed Falis" Content-Type: text/plain; format=flowed; delsp=yes; charset=us-ascii MIME-Version: 1.0 Content-Transfer-Encoding: 8bit User-Agent: Opera M2(BETA1)/8.00 (Linux, build 913) Date: Wed, 09 Mar 2005 15:23:30 GMT NNTP-Posting-Host: 70.19.208.151 X-Complaints-To: abuse@verizon.net X-Trace: trndny06 1110381810 70.19.208.151 (Wed, 09 Mar 2005 10:23:30 EST) NNTP-Posting-Date: Wed, 09 Mar 2005 10:23:30 EST Xref: g2news1.google.com comp.lang.ada:8938 comp.lang.c++:44774 comp.realtime:1129 comp.software-eng:4687 Date: 2005-03-09T15:23:30+00:00 List-Id: On 09 Mar 2005 15:55:38 +0100, Pascal Obry wrote: >> Can you program "const correct"? Eg. if you declare a member function >> as const the compiler will help you not mutate the object or call any >> functions that do. Also, if you pass a parameter as a const reference, >> you will not be able to mutate the object the parameter references. Ada supports the first functionality - not modifying the parameter itself (since it is of mode "in" or "access"). This is for all parameters to functions (as distinct from procedures). Ada does not support the idea of a const reference, though: if the function parameter is of an access type, or mode "access", the reference to the object cannot be changed, but the contents of the referenced object can be.