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,dc1fff2721602dfa X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.66.86.73 with SMTP id n9mr887865paz.17.1359583607233; Wed, 30 Jan 2013 14:06:47 -0800 (PST) Path: s9ni26548pbb.0!nntp.google.com!news.glorb.com!news-out.readnews.com!transit3.readnews.com!panix!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!.POSTED!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Ada and string literals Date: Wed, 30 Jan 2013 17:06:46 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <4978d638-a04b-4561-85e9-cf6620265af2@googlegroups.com> <86boc63n5d.fsf@gaheris.avalon.lan> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 X-Trace: pcls6.std.com 1359583606 8584 192.74.137.71 (30 Jan 2013 22:06:46 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Wed, 30 Jan 2013 22:06:46 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:SgCFUAS/rMycIkgOHPfs6yVAMoA= Content-Type: text/plain; charset=us-ascii Date: 2013-01-30T17:06:46-05:00 List-Id: codeallergy writes: > Okay. assuming dat we use GNAT 2012 > > Literal1 : aliased constant String := "LITERAL"; > Literal2 : aliased constant String := "LITERAL"; > Literal3 : aliased constant String := "LITERAL"; > > how the above code is handled ? > > compiler duplicate the string three times into the data section or Yes, that's the most likely implementation. > the three constants will share the same string or That won't work, because Literal1 = Literal2 must be False. If you leave out "aliased", then the compiler might share. > one string into the data section but duplicated at the run time ? That would work, but I don't see why a compiler would do that. - Bob