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,a41c4a2c795dbe34 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!news.glorb.com!feeder.erje.net!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!jacob-sparre.dk!ada-dk.org!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Will "renames" increase program size? Date: Wed, 15 Jun 2011 00:37:22 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <46294109-f07d-49c0-8e81-65a369a05ced@z15g2000prn.googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1308116246 21533 69.95.181.76 (15 Jun 2011 05:37:26 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Wed, 15 Jun 2011 05:37:26 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6090 Xref: g2news2.google.com comp.lang.ada:20807 Date: 2011-06-15T00:37:22-05:00 List-Id: "Adrian Hoe" wrote in message news:46294109-f07d-49c0-8e81-65a369a05ced@z15g2000prn.googlegroups.com... > Hi, > > Just out of curiosity, will "renames" increase program size? > > e,g, > > package A renames Ada.Text_IO; > > P : Person_Rec renames Personnel_Record; > > I presume Ada compiler will replace the names just like #define in C, > so no increase in program size. But I just want to be sure. It depends on what you rename. If you rename something that requires runtime evaluation, then there will be a small amount of overhead to do that evaluation and save the result. But most renames don't need to do that. Some examples where there probably would be some overhead: Obj : Natural renames My_Array (Some_Variable).all; Obj2 : Float renames Some_Function (A, B); Recall that a renames is only evaluated once, at the point of the renames. You can use this to shrike code size as well (if the item renamed is expensive to evaluate and it is referenced multiple times). Randy.