comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Will "renames" increase program size?
Date: Wed, 15 Jun 2011 00:37:22 -0500
Date: 2011-06-15T00:37:22-05:00	[thread overview]
Message-ID: <it9gem$l0t$1@munin.nbi.dk> (raw)
In-Reply-To: 46294109-f07d-49c0-8e81-65a369a05ced@z15g2000prn.googlegroups.com

"Adrian Hoe" <abyhoe@gmail.com> 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.





  reply	other threads:[~2011-06-15  5:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-15  2:10 Will "renames" increase program size? Adrian Hoe
2011-06-15  5:37 ` Randy Brukardt [this message]
2011-06-15  9:11   ` AdaMagica
2011-06-15 11:26     ` Yannick Duchêne (Hibou57)
2011-06-15 11:24   ` Yannick Duchêne (Hibou57)
2011-06-15 13:15     ` Dmitry A. Kazakov
2011-06-16  6:59       ` AdaMagica
2011-06-16  8:59         ` Dmitry A. Kazakov
2011-06-16 10:18           ` AdaMagica
2011-06-16 12:15             ` Dmitry A. Kazakov
2011-06-16 23:22             ` Randy Brukardt
2011-06-16 15:40           ` Adam Beneschan
2011-06-16 16:33             ` Dmitry A. Kazakov
2011-06-16 17:42               ` Adam Beneschan
2011-06-16 18:53                 ` Dmitry A. Kazakov
2011-06-16 23:39                   ` Randy Brukardt
2011-06-17  6:53                     ` Dmitry A. Kazakov
2011-06-18  0:02                       ` Randy Brukardt
2011-06-18  7:54                         ` Dmitry A. Kazakov
2011-06-18  8:58                           ` Yannick Duchêne (Hibou57)
2011-06-18 10:05                             ` Dmitry A. Kazakov
2011-06-18 12:49                               ` Yannick Duchêne (Hibou57)
2011-06-18 22:44                           ` Randy Brukardt
2011-06-22  0:56                             ` Shark8
2011-06-15 22:21 ` anon
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox