comp.lang.ada
 help / color / mirror / Atom feed
From: "Steve" <nospam_steved94@comcast.net>
Subject: Re: Semantics of Inline vs non-Inline
Date: Fri, 15 Oct 2004 03:40:06 GMT
Date: 2004-10-15T03:40:06+00:00	[thread overview]
Message-ID: <qEHbd.242144$MQ5.96106@attbi_s52> (raw)
In-Reply-To: 35f054ea.0410140733.5f250e6f@posting.google.com

For what it's worth I am in full agreement with your claim.  Inline
expansion of subprograms is described in section 6.3.2 of the Ada 95
Reference manual.

No special considerations are given for accessability of values and in fact
the compiler is explicity given permission to ignore the inline
recommendation.  I would agree that if the code fails with the inline pragma
and succeeds otherwise, the compiler is broken.  Of course I'm not an
authority.

Steve
(The Duck)

"skidmarks" <aschwarz@acm.org> wrote in message
news:35f054ea.0410140733.5f250e6f@posting.google.com...
> My compiler vendor says that the semantics of an inline/non-inline
> function can be different at the discretion of the compiler vendor. In
> particular, if at the point of use of an inline function the value of
> an argument (to the defined subprogram) is in a register, then it is
> acceptable to 'crash' because the address of the argument is not known
> (it's in a register).
>
> My claim is that the semantics of of an inline and non-inline
> subprogram must be identical, and further, the application writer is
> both unaware and should be unaware of the code generated at the point
> of subprogram use.
>
> Any idea which view is the correct one?
>
> Art
>
> ----------------------------------------------------------
> Example (in truncated pseudo-Ada):
>
> package body x is
>    subtype Datum_Type is Natural;
>    package List is new abc.List_Manager( <size> );
>    function Push( Datum : Datum_Type ) return List.Cell_Ptr is
>       LM_Datum : List.Datum_Type;
>                  for LM_Datum'Address use Datum'Address;
>    begin -- Push
>      return List.Push(LM_Datum);
>    end Push;
>    pragma inline( Push );
>
>    Cell : List.Cell_Ptr;
>    thing: Natural;
> begin -- x
>    Cell := Push(thing);
> end x;
>
> This code does not work with    'pragma inline'.
> This code does     work without 'pragma inline'.
>
> The vendor claims that the address of 'thing' is not known at the call
> (it may be in a register) and hence the inlined 'Push' does not have a
> valid input argument. My first statement is that the behavior for
> inline/non-inline should be the same, and that if it succeeds in one
> it should succeed in all. Is this a correct interpretation?





  parent reply	other threads:[~2004-10-15  3:40 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <35f054ea.0410140733.5f250e6f@posting.google.com>
2004-10-14 16:14 ` Semantics of Inline vs non-Inline Wojtek Narczynski
2004-10-14 20:05   ` Arthur Schwarz
2004-10-15 10:24     ` Wojtek Narczynski
2004-10-15 16:32       ` Arthur Schwarz
2004-10-14 17:58 ` Martin Krischik
2004-10-15  0:49   ` Arthur Schwarz
2004-10-15  8:05     ` Martin Krischik
2004-10-15 16:39       ` Arthur Schwarz
2004-10-15 16:40       ` Arthur Schwarz
2004-10-15 16:40       ` Arthur Schwarz
2004-10-15 16:45       ` skidmarks
2004-10-15  3:40 ` Steve [this message]
2004-10-15  5:50 ` Simon Wright
2004-10-15 16:57   ` skidmarks
2004-10-18 17:01 ` skidmarks
2004-10-15  6:18 Christoph Karl Walter Grein
2004-10-15 11:02 ` Wojtek Narczynski
  -- strict thread matches above, loose matches on Subject: below --
2004-10-18  6:29 Christoph Karl Walter Grein
2004-10-20 15:07 ` Wojtek Narczynski
2004-10-21  5:07 Christoph Karl Walter Grein
2004-10-21 10:24 ` Wojtek Narczynski
2004-10-21 11:21 Christoph Karl Walter Grein
2004-10-21 20:57 ` Wojtek Narczynski
2004-10-22  0:46 ` skidmarks
2004-10-22  5:50   ` Simon Wright
2004-10-22 12:57     ` Wojtek Narczynski
replies disabled

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