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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.58.198.116 with SMTP id jb20mr2282625vec.4.1386378258667; Fri, 06 Dec 2013 17:04:18 -0800 (PST) X-Received: by 10.49.35.107 with SMTP id g11mr132803qej.5.1386378258647; Fri, 06 Dec 2013 17:04:18 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.bbs-scene.org!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!p15no8979262qaj.0!news-out.google.com!9ni2660qaf.0!nntp.google.com!p15no8979253qaj.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 6 Dec 2013 17:04:18 -0800 (PST) In-Reply-To: <030e719b-05ec-43ef-9d01-d2c473350704@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=75.161.11.227; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 75.161.11.227 References: <361fb7d4-d22e-4ac3-a307-48108c4f8eb0@googlegroups.com> <030e719b-05ec-43ef-9d01-d2c473350704@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Renaming vs assignment to constant From: Shark8 Injection-Date: Sat, 07 Dec 2013 01:04:18 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:17886 Date: 2013-12-06T17:04:18-08:00 List-Id: On Friday, December 6, 2013 4:48:41 PM UTC-7, adambe...@gmail.com wrote: > > > I think the big difference happens when the result has subcomponents: > > ch : constant Character:= 'X'; -- Character X. > > temp : String renames Character'Image(ch); -- Its image: 'X'. > > ch2 : Character renames temp(2); -- The unquoted character. Size of Ch: Assuming 8. Size of temp: 24 + Bounds(assuming 64). Size of Ch2: None, it's a reference-to/alias-of Temp(2). Total 96 bits. > What is the big difference between that and > ch : constant Character:= 'X'; -- Character X. > temp : constant String := Character'Image(ch); -- Its image: 'X'. > ch2 : constant Character := temp(2); -- The unquoted character. Size of Ch: Assuming 8. Size of temp: 24 + Bounds(assuming 64). Size of Ch: Assuming 8. Total 104 bits. Obviously this will really only make a real difference performance-wise when the renamed object's type is large, but there're other reasons to use renames, like component selection of deeply composed objects... but that's a different topic.