comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@largo.mitre.org (Robert I. Eachus)
Subject: Re: Use pragma INLINE or not?
Date: 19 Jun 91 15:15:50 GMT	[thread overview]
Message-ID: <EACHUS.91Jun19111550@largo.mitre.org> (raw)
In-Reply-To: stluka@neptune.software.org's message of 18 Jun 91 17:14:59 GMT

In article <1991Jun18.171459.11744@software.org> stluka@neptune.software.org (Fred Stluka) writes:

   About the use of pragma INLINE...There seem to be 2 schools of
thought, what do you think?

   Pragmas are supposed to be advice to the compiler, and a good
compiler should NOT ingnore that advice.  But there are actually two
separate cases, and I get frustrated by compilers which try to "help"
me when it is inappropriate.

   If a procedure or function call is internal to the unit which
defines that subprogram, compilers should inline when obviously
beneficial, and inline in all cases if the programmer requests it.
(Yes, that includes subprograms which may call themselves directly or
indirectly, inline the original call and generate explicit call where
necessary for recursion.  In cases of indirect recursion, a programmer
can use pragma INLINE to help the compiler decide where explicit calls
should be put.)

   However when a call is to a subprogram exported by another library
unit, a compiler should not inline absent an explicit pragma, since
the programmer may not want the extra dependencies created.

   My usual style is to put a commented out pragma INLINEs in the
package specs if I want inlining in the final version, and remove the
comments only for major builds or for a final version.  A compiler
option to ignore pragma INLINE would be nice, but very tricky to
implement usefully except on a per library basis.  As it is, the
uncommenting is just one of many automatic steps in the process of
doing a build.
--

					Robert I. Eachus

with STANDARD_DISCLAIMER;
use  STANDARD_DISCLAIMER;
function MESSAGE (TEXT: in CLEVER_IDEAS) return BETTER_IDEAS is...

  parent reply	other threads:[~1991-06-19 15:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1991-06-18 17:14 Use pragma INLINE or not? Fred Stluka
1991-06-19  8:58 ` Orville R. Weyrich
1991-06-19 15:15 ` Robert I. Eachus [this message]
1991-06-19 15:57 ` Brian Hanafee
1991-06-19 21:51 ` George C. Harrison, Norfolk State University
1991-06-19 23:44 ` Jim Showalter
1991-06-27 16:13   ` Robert Firth
1991-06-27 21:00     ` Michael Feldman
1991-06-28 12:39       ` Kenneth B. Hawks
1991-06-28 17:56         ` Lance E Murray
1991-06-28 15:09       ` Use pragma INLINE or not? (SUMMARY) Fred Stluka
  -- strict thread matches above, loose matches on Subject: below --
1991-06-20 13:07 Use pragma INLINE or not? Bevin Brett
replies disabled

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