* system."+" renaming using GNAT
@ 1999-01-12 0:00 Oliver Hilgendorf
1999-01-12 0:00 ` David C. Hoos, Sr.
1999-01-13 0:00 ` Tucker Taft
0 siblings, 2 replies; 3+ messages in thread
From: Oliver Hilgendorf @ 1999-01-12 0:00 UTC (permalink / raw)
The following statement
function "+" (Left : in System.Address; Right : in Integer)
return System.Address renames system."+";
works fine using the Rational Ada compiler (for Solaris) . It doesn't
work with GNAT (for NT) since "+" is not defined in its package
system.
How can I make it work?
Oliver
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: system."+" renaming using GNAT
1999-01-12 0:00 system."+" renaming using GNAT Oliver Hilgendorf
@ 1999-01-12 0:00 ` David C. Hoos, Sr.
1999-01-13 0:00 ` Tucker Taft
1 sibling, 0 replies; 3+ messages in thread
From: David C. Hoos, Sr. @ 1999-01-12 0:00 UTC (permalink / raw)
Oliver Hilgendorf wrote in message <369bb27b.18027210@news.nacamar.de>...
>The following statement
>
> function "+" (Left : in System.Address; Right : in Integer)
>return System.Address renames system."+";
>
>works fine using the Rational Ada compiler (for Solaris) . It doesn't
>work with GNAT (for NT) since "+" is not defined in its package
>system.
>
>How can I make it work?
>
The package System.Storage_Elements has the following function:
function "+"(Left : Address; Right : Storage_Offset)
return Address;
If you change your code to read:
function "+" (Left : in System.Address; Right : in Integer)
return System.Address is
use System.Storage_Elements;
begin
return Left + Storage_Offset (Right);
end "+";
You should do just fine.
David C. Hoos, Sr.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: system."+" renaming using GNAT
1999-01-12 0:00 system."+" renaming using GNAT Oliver Hilgendorf
1999-01-12 0:00 ` David C. Hoos, Sr.
@ 1999-01-13 0:00 ` Tucker Taft
1 sibling, 0 replies; 3+ messages in thread
From: Tucker Taft @ 1999-01-13 0:00 UTC (permalink / raw)
Oliver Hilgendorf (news@hilgendorf.de) wrote:
: The following statement
: function "+" (Left : in System.Address; Right : in Integer)
: return System.Address renames system."+";
: works fine using the Rational Ada compiler (for Solaris) . It doesn't
: work with GNAT (for NT) since "+" is not defined in its package
: system.
: How can I make it work?
Ada 95 defines a "+" between Address and an integer type
in the package System.Storage_Elements. The integer type
is System.Storage_Elements.Storage_Offset. Hence,
don't make it a rename; instead, implement it portably as follows:
with System.Storage_Elements;
...
function "+"(Left : in System.Address; Right : in Integer)
return System.Address is
begin
return System.Storage_Elements."+"(Left, System.Storage_Offset(Right));
end "+";
: Oliver
--
-Tucker Taft stt@averstar.com http://www.averstar.com/~stt/
Technical Director, Distributed IT Solutions (www.averstar.com/tools)
AverStar (formerly Intermetrics, Inc.) Burlington, MA USA
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1999-01-13 0:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-01-12 0:00 system."+" renaming using GNAT Oliver Hilgendorf
1999-01-12 0:00 ` David C. Hoos, Sr.
1999-01-13 0:00 ` Tucker Taft
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox