comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Eachus <rieachus@comcast.net>
Subject: Re: no + or - defined for fixed point types in Standard, why ?
Date: Wed, 24 Jan 2018 17:09:19 -0800 (PST)
Date: 2018-01-24T17:09:19-08:00	[thread overview]
Message-ID: <0829e4c2-ea35-4a87-b5b4-330093ac739c@googlegroups.com> (raw)
In-Reply-To: <21d0a0b8-8c66-42fb-9d4a-dc9dbbc33521@googlegroups.com>

On Wednesday, January 24, 2018 at 1:36:59 PM UTC-5, Mehdi Saada wrote:
 > I don't understand. To me either it's visible, either it's not... 
In Ada declarations are directly visible if they are declared in the current scope, or an enclosing scope.  Declarations are use visible if they are only visible due to a use clause.

A directly visible declaration hides any use visible declarations.  However, you can (almost always) use a qualified name to reference something which is use visible i.e. Ada.Text_IO.Put if there is another put declared locally that hides it.

About the almost always?  Don't do that!  The examples I used in testing almost always included a package Standard as a library unit...

> 
> Even with the conversion method, the warning about overridding won't go away. Eventhough there's no explicit call on Standard anymore.
> 
> > You are trying to do something wonky, and the compiler is telling you that.
> I could tell before trying  ;-)

As I said, you can turn off warnings if it bothers you.  I think if you look through the GNAT sources, there are a number of places where they do that.  As a programming practice, I like it.  It says that the programmer knows that the compiler won't like this, but I want to do it anyway.

A perfect example is a test to insure that a compiler raises Program_Error if a function "runs off the end" which is fine for procedures.

function Test is
begin if false then return; end if; end Test;

See what your compiler says about that.


  reply	other threads:[~2018-01-25  1:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-24 17:03 no + or - defined for fixed point types in Standard, why ? Mehdi Saada
2018-01-24 17:44 ` Robert Eachus
2018-01-24 18:36   ` Mehdi Saada
2018-01-25  1:09     ` Robert Eachus [this message]
2018-01-25  1:31       ` guyclaude.burger
2018-01-25  3:07         ` Robert Eachus
2018-01-25  3:25 ` Randy Brukardt
2018-01-25 13:33   ` Mehdi Saada
2018-01-26  4:34     ` Randy Brukardt
replies disabled

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