comp.lang.ada
 help / color / mirror / Atom feed
From: Gautier write-only <gautier_niouzes@hotmail.com>
Subject: Re: Performance of access type : a tiny mistake in the WikiBook ?
Date: Thu, 8 Oct 2009 02:55:20 -0700 (PDT)
Date: 2009-10-08T02:55:20-07:00	[thread overview]
Message-ID: <87659df3-42a8-456b-9788-f37c4c1cbdb1@o21g2000vbl.googlegroups.com> (raw)
In-Reply-To: f4a9b321-7ab8-49e5-9fa1-373cf3553f5a@j9g2000vbp.googlegroups.com

> I understand what you mean about testing, but I am mainly looking for
> average answers. Just things to know and to have in mind. Even if
> there is no required implementation, it is well known that a lot of
> compilers share some common implementation designs. I'm seeking for
> informations about it, just like the way I'm sometime reading about
> general tips or thoughts (I used to do the same with some prior
> languages like Pascal and Eiffel, it's a bit part of learning the
> thing).

So here is my rule: use only "in" (whenever possible), "in out" and
"out" and you will be happy.
These modes are meaningful for you and the compiler knows how to
handle it efficiently. Especially the compiler will consider passing
by copy, even through a register (and not on the stack), an "in"
parameter:

  procedure P_in(i: in Integer; s: in String) is
  begin
    Put_Line(Integer'Image(i));
    Put_Line(s);
  end;

The call P_in(5678,s) is compiled by GNAT GPL 2008 with (-gnatp -O2)
as:

        movl    %edi, %edx
        movl    %esi, %ecx
        movl    $5678, %eax
        call    _test_in_out__p_in.1893
_________________________________________________________
Gautier's Ada programming -- http://sf.net/users/gdemont/
NB: For a direct answer, e-mail address on the Web site!



  parent reply	other threads:[~2009-10-08  9:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-07 20:59 Performance of access type : a tiny mistake in the WikiBook ? Hibou57 (Yannick Duchêne)
2009-10-07 22:38 ` (see below)
2009-10-07 23:30   ` Yannick Duchêne Hibou57
2009-10-08  0:30     ` (see below)
2009-10-08  0:48       ` Yannick Duchêne Hibou57
2009-10-08  9:11         ` Dmitry A. Kazakov
2009-10-08  9:55         ` Gautier write-only [this message]
2009-10-08 16:04           ` Yannick Duchêne Hibou57
2009-10-08 16:46             ` Yannick Duchêne Hibou57
2009-10-08 19:41             ` Gautier write-only
2009-10-09  6:14               ` Yannick Duchêne Hibou57
2009-10-09 18:51                 ` sjw
replies disabled

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