comp.lang.ada
 help / color / mirror / Atom feed
From: rosen@gypsy.UUCP
Subject: Please Test This
Date: Thu, 3-Oct-85 13:29:00 EDT	[thread overview]
Date: Thu Oct  3 13:29:00 1985
Message-ID: <38000023@gypsy.UUCP> (raw)


Can someone run this small program through their Ada compiler and let me
know what it has to say.  I've already run it though the Verdix compiler and
the Ada/ED compiler both for Unix 4.2 on a Vax.  If you have a different
compiler, then I'd like to know what it has to say.

The error concerns the importation of the equality operator for objects that
are of an access type and are declared in a different package.  The Verdix
compiler says that if I do not issue a "use" clause for the imported package
(the one with the access type definitions), then I must qualify the "="
operator since it is not directly visible.  The Ada/ED compiler doesn't
require this.  I believe the Verdix compiler is right since it is taking the
LRM literally, but I would like to know what other compilers say.

Here's the program:

----------------------------------------------------------------------------

package IMPORT_ACCESS_TYPE is

  type POINTER is access INTEGER;
  --
  -- Declaration of a public access type.
  --
  
end IMPORT_ACCESS_TYPE;

----------------------------------------------------------------------------

with IMPORT_ACCESS_TYPE;  -- Notice the the lack of a 'use' clause
			  -- which is very important in this example

procedure MAIN is
  X,Y: IMPORT_ACCESS_TYPE.POINTER;
begin

  --
  -- The compiler will/should complain about the test for equality in the
  -- following statement since the "=" operator is not directly visible.
  -- 
  if (X = null) then
    Y := X;
  end if;

  --
  -- The compiler should not complain about the test for equality in the
  -- following statement.  This form is required if there is no "use" clause
  -- for the package which declares the access types.
  --
  if (IMPORT_ACCESS_TYPE."=" (X, null)) then
    Y := X;
  end if;

end MAIN;

----------------------------------------------------------------------------

------------
Steve Rosen
Siemens Research and Technology Laboratories
Princeton, NJ

USENET: {ihnp4|princeton|adrvax}!siemens!gypsy!rosen
ARPA:   siemens!gypsy!rosen@TOPAZ

             reply	other threads:[~1985-10-03 17:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1985-10-03 17:29 rosen [this message]
1985-10-07 15:21 ` Please Test This stt
replies disabled

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