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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,dc1fff2721602dfa X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.224.189.78 with SMTP id dd14mr3412713qab.0.1359586441464; Wed, 30 Jan 2013 14:54:01 -0800 (PST) X-Received: by 10.49.15.6 with SMTP id t6mr676525qec.20.1359586441387; Wed, 30 Jan 2013 14:54:01 -0800 (PST) Path: k2ni3907qap.0!nntp.google.com!p13no7221635qai.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 30 Jan 2013 14:54:01 -0800 (PST) In-Reply-To: <4978d638-a04b-4561-85e9-cf6620265af2@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=83.101.43.210; posting-account=BX0hiQoAAACh1jwwbtKtvsAU1boh6owG NNTP-Posting-Host: 83.101.43.210 References: <4978d638-a04b-4561-85e9-cf6620265af2@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Ada and string literals From: codeallergy Injection-Date: Wed, 30 Jan 2013 22:54:01 +0000 Content-Type: text/plain; charset=ISO-8859-1 Date: 2013-01-30T14:54:01-08:00 List-Id: Thanks for answering. i reversed the generated code. when u use a literal as a argument like this Put_Line("HELLO"); Abc("HELLO"); the same string from the data section is shared. when you use constants from a package like this package Abc is str1 : aliased constant String : "LITERAL"; str2 : aliased constant String : "LITERAL"; end Abc; strings are duplicated and put into the data section, aliased or not. when you use constant from a procedure header (dunno how u name that) like this procedure Abc is str1 : aliased constant String : "LITERAL"; begin null; end Abc; if the constant is aliased, the constant is not put into the data section but "hardcoded" and push on the stackframe like this: .text:00401FA2 mov dword ptr [ebp-104h], 1 .text:00401FAC mov dword ptr [ebp-100h], 7 .text:00401FB6 mov dword ptr [ebp-0FCh], 4554494Ch ; 4C49544552414C = "LITERAL" .text:00401FC0 mov word ptr [ebp-0F8h], 4152h .text:00401FC9 mov byte ptr [ebp-0F6h], 4Ch if not aliased the constant is put into the data section. - Rom B.