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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,c9d5fc258548b22a X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!feeder.news-service.com!feeder2.cambriumusenet.nl!feed.tweaknews.nl!87.79.20.105.MISMATCH!news.netcologne.de!ramfeed1.netcologne.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: How do I write directly to a memory address? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <67063a5b-f588-45ea-bf22-ca4ba0196ee6@l11g2000yqb.googlegroups.com> <31c357bd-c8dc-4583-a454-86d9c579e5f4@m13g2000yqb.googlegroups.com> <05a3673e-fb97-449c-94ed-1139eb085c32@x1g2000yqb.googlegroups.com> <8r86vgFc3uU1@mid.individual.net> <19fh1chm74f9.11cws0j5bckze.dlg@40tude.net> <5d9bd120-4953-4fb1-a890-27267245e954@8g2000prt.googlegroups.com> <544076dc-3357-4d8d-bfeb-7ae46a88b931@w19g2000yqa.googlegroups.com> Date: Mon, 7 Feb 2011 10:24:49 +0100 Message-ID: <9bt91saw1vao$.9o7azvb4ina6$.dlg@40tude.net> NNTP-Posting-Date: 07 Feb 2011 10:24:50 CET NNTP-Posting-Host: 9d607406.newsspool3.arcor-online.net X-Trace: DXC=LMe@@kbdbdS?M0YMcF=Q^Z^V3X4Fo<]lROoRQ8kF1@A\TYiM3[[6LHn;2LCV^7enW;^6ZC`T\`mfM[68DCSThN=]gWneNZ X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:16919 Date: 2011-02-07T10:24:50+01:00 List-Id: On Mon, 7 Feb 2011 01:05:20 -0800 (PST), Maciej Sobczak wrote: > On Feb 7, 9:38�am, "Dmitry A. Kazakov" > wrote: > >>> Scalar arguments are passed by copy, so whether they are immutable or >>> mutable within the function is independent on their origin (and the >>> original is not affected by this in any way). >>> Unless, of course, you have meant something else. >> >> Exactly this. Passing mode (by copy vs. by reference) has nothing to do >> with the mutability contract. Unchanged origin is no argument, because the >> contract is broken [*]. > > The contract is not broken. The function cannot modify the original > value that is passed by copy (this being the very nature of "copy") > and the caller cannot even reason about what happens behind the > signature. It is broken because const T is not substitutable for T. Mutators of the type T are not operations of const T. q.e.d. P.S. Contract is between two parties. P.P.S. You may have a working program full of unstated, idiotic, meaningless, broken contracts. This is how modern S/W industry works. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de