comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Question about pragma Restrictions(No_Recursion)
Date: Tue, 22 Jul 2014 12:02:05 -0700
Date: 2014-07-22T12:02:05-07:00	[thread overview]
Message-ID: <lqmcfe$hnv$2@dont-email.me> (raw)
In-Reply-To: <mNWdneJO2MleN1PO4p2dnAA@giganews.com>

On 07/22/2014 11:17 AM, Peter Chapin wrote:
>
> I understand this to mean that the restriction, in this case, is really
> a restriction on what the programmer does. The compiler is not obligated
> to detect recursive constructs, however it could potentially (maybe)
> simplify its runtime system on the assumption that no recursion exists.
> If that assumption is wrong, well it's the programmer's problem.
>
> Does that sound right?

This seems similar to me to the restriction on potentially blocking operations 
in protected actions (ARM 9.5.1). Ideally, a compiler would arrange to raise 
Program_Error for every such case, and probably issue a compiler warning that 
this would happen. In practice, this requires things that are considered 
undesirable in most cases, and so is not required. (Pragma Detect_Blocking in 
H.5 can be used to force this if the compiler implements Annex H.)

In practice, most compilers detect direct invocation of a potentially blocking 
operation in a protected subprogram and ignore indirect invocations. So, for 
most compilers in most situations, this restriction is effectively meaningless.

Probably compilers implementing the No_Recursion restriction take a similar 
approach: if a subprogram calls itself directly, this is detected, but indirect 
recursion is not, and really it's up to the developer to decide if he wants to 
sneak in recursion anyway.

-- 
Jeff Carter
"I'm a lumberjack and I'm OK."
Monty Python's Flying Circus
54


      parent reply	other threads:[~2014-07-22 19:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-22 18:17 Question about pragma Restrictions(No_Recursion) Peter Chapin
2014-07-22 18:40 ` Robert A Duff
2014-07-22 19:02 ` Jeffrey Carter [this message]
replies disabled

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