comp.lang.ada
 help / color / mirror / Atom feed
* How to print Task_ID type? (GNAT SunOS)
@ 1996-04-03  0:00 Greg Bond
  1996-04-04  0:00 ` Robert Dewar
  0 siblings, 1 reply; 15+ messages in thread
From: Greg Bond @ 1996-04-03  0:00 UTC (permalink / raw)


Can one of the Text_IO packages be used to print a Task_ID type (or any 
access Integer type for that matter...)? I'm using GNAT under SunOS 
which defines the Task_ID type in Ada.Task_Identification as private, 
but implements it as an Integer access type. If one of the Text_IO 
packages won't work, then what will?

--
* Greg Bond                         * Dept. of Electrical Eng.  
* email: bond@ee.ubc.ca             * Univ. of British Columbia      
* voice: (604) 822 0899             * 2356 Main Mall                 
* fax:   (604) 822 5949             * Vancouver, BC              
* web: http://www.ee.ubc.ca/~bond   * Canada, V6T 1Z4




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How to print Task_ID type? (GNAT SunOS)
  1996-04-03  0:00 How to print Task_ID type? (GNAT SunOS) Greg Bond
@ 1996-04-04  0:00 ` Robert Dewar
  1996-04-04  0:00   ` Greg Bond
                     ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Robert Dewar @ 1996-04-04  0:00 UTC (permalink / raw)


Greg asks

"Can one of the Text_IO packages be used to print a Task_ID type (or any
access Integer type for that matter...)? I'm using GNAT under SunOS
which defines the Task_ID type in Ada.Task_Identification as private,
but implements it as an Integer access type. If one of the Text_IO
packages won't work, then what will?"

Certainly not, private means private, neither you nor Text_IO can
mess with a private type in another package. Well you culd use
unchecked conversion after looking in the private part, but that
would NOT be pleasant code.

What do you really need to do here? Doesn't the Image function for
Task_Id do what you want? That's what it's for!

   function Image (T : Task_Id) return String;





^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How to print Task_ID type? (GNAT SunOS)
  1996-04-04  0:00 ` Robert Dewar
  1996-04-04  0:00   ` Greg Bond
@ 1996-04-04  0:00   ` Greg Bond
  1996-04-05  0:00     ` Robert Dewar
  1996-04-05  0:00     ` Keith Thompson
  1996-04-05  0:00   ` Laurent Guerby
  2 siblings, 2 replies; 15+ messages in thread
From: Greg Bond @ 1996-04-04  0:00 UTC (permalink / raw)


Robert Dewar wrote:
> 
> Greg asks
> 
> "Can one of the Text_IO packages be used to print a Task_ID type (or any
> access Integer type for that matter...)? I'm using GNAT under SunOS
> which defines the Task_ID type in Ada.Task_Identification as private,
> but implements it as an Integer access type. If one of the Text_IO
> packages won't work, then what will?"
> 
> Certainly not, private means private, neither you nor Text_IO can
> mess with a private type in another package. Well you culd use
> unchecked conversion after looking in the private part, but that
> would NOT be pleasant code.
> 
> What do you really need to do here? Doesn't the Image function for
> Task_Id do what you want? That's what it's for!
> 
>    function Image (T : Task_Id) return String;


Indeed it is. My oversight. This function does not handle the more 
general problem I posed though. Is there a general facility for printing 
access types? The GNAT implementation of the Image function above is a 
system level (i.e. platform dependent) routine specifically for the 
Task_ID type. The only Ada references I've got are Barnes for Ada 95 and 
the ALRM, both of which are woefully inadequate on the topic of Ada I/O.





--
* Greg Bond                         * Dept. of Electrical Eng.  
* email: bond@ee.ubc.ca             * Univ. of British Columbia      
* voice: (604) 822 0899             * 2356 Main Mall                 
* fax:   (604) 822 5949             * Vancouver, BC              
* web: http://www.ee.ubc.ca/~bond   * Canada, V6T 1Z4




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How to print Task_ID type? (GNAT SunOS)
  1996-04-05  0:00   ` Laurent Guerby
@ 1996-04-04  0:00     ` Joel Sherrill
  1996-04-06  0:00       ` Fergus Henderson
  0 siblings, 1 reply; 15+ messages in thread
From: Joel Sherrill @ 1996-04-04  0:00 UTC (permalink / raw)




In article <4xu3yzpoi7.fsf@leibniz.enst-bretagne.fr>, Laurent.Guerby@enst-bretagne.fr (Laurent Guerby) writes:
>Greg Bond writes
>: Indeed it is. My oversight. This function does not handle the more 
>: general problem I posed though. Is there a general facility for printing 
>: access types? 
>
>   No,  like in C you have  to convert them to  an integer type before
>printing  them  using your  favourite  output routine   (printf or Put
>;-).  This can be done in  "portable" Ada 95  (as far as  this kind of
>game can be tagged as portable ...) :

I am not sure what the origin of the "%p" printf specifier is but it is present for all the 
C libraries I use.  With it, you can:

  printf( "The address of X is %p\n", &X );

You are correct that without this, you must convert the address to an integer format.

+----------------------------------------+--------------------------------+
| Joel Sherrill                          | Sr. Computer Scientist         |
| joel@merlin.gcs.redstone.army.mil      | On-Line Applications Research  |
| Ask me about RTEMS: a free real-time   | Huntsville AL 35805            |
|   multiprocessor executive!            | (205) 883-0131                 |
+----------------------------------------+--------------------------------+







^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How to print Task_ID type? (GNAT SunOS)
  1996-04-04  0:00 ` Robert Dewar
@ 1996-04-04  0:00   ` Greg Bond
  1996-04-04  0:00   ` Greg Bond
  1996-04-05  0:00   ` Laurent Guerby
  2 siblings, 0 replies; 15+ messages in thread
From: Greg Bond @ 1996-04-04  0:00 UTC (permalink / raw)


Laurent Guerby wrote:
> 
> Greg Bond writes
> : Indeed it is. My oversight. This function does not handle the more
> : general problem I posed though. Is there a general facility for printing
> : access types?
> 

[Loads of good stuff that answers the above question deleted...]

> 
> : The GNAT implementation of the Image function above is a
> : system level (i.e. platform dependent) routine specifically for the
> : Task_ID type. The only Ada references I've got are Barnes for Ada 95 and
> : the ALRM, both of which are woefully inadequate on the topic of Ada I/O.
> 
>    I don't share  your point of view  (both on Barnes  and on the RM95
> ;-).  You can do plenty  of things if  you take the  time to read  the
> Text_IO  description in the RM (83  and 95), and  incredible things if
> you take time to read the Stream section of the RM95 ;-).
> 

I'm sure this is the case for experienced Ada programmers but for those of us learning Ada for 
the first time (myself and my students included), *examples* of I/O help one assimilate the 
concepts much faster than just a dry description from a reference manual (or Barnes' book). I 
don't expect examples in a reference manual, but I do expect them in a text book. Barnes' book, 
while generally good, relegates I/O to only a part of a chapter and includes virtually no 
examples. I/O is one of those fundamental topics that should be covered in detail in any 
language text - especially when the I/O interface is standardized!

--
* Greg Bond                         * Dept. of Electrical Eng.  
* email: bond@ee.ubc.ca             * Univ. of British Columbia      
* voice: (604) 822 0899             * 2356 Main Mall                 
* fax:   (604) 822 5949             * Vancouver, BC              
* web: http://www.ee.ubc.ca/~bond   * Canada, V6T 1Z4




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How to print Task_ID type? (GNAT SunOS)
  1996-04-04  0:00   ` Greg Bond
  1996-04-05  0:00     ` Robert Dewar
@ 1996-04-05  0:00     ` Keith Thompson
  1996-04-05  0:00       ` Greg Bond
  1996-04-05  0:00       ` Robert Dewar
  1 sibling, 2 replies; 15+ messages in thread
From: Keith Thompson @ 1996-04-05  0:00 UTC (permalink / raw)


In <31642F61.1D2B@ee.ubc.ca> Greg Bond <bond@ee.ubc.ca> writes:
[...]
> Indeed it is. My oversight. This function does not handle the more 
> general problem I posed though. Is there a general facility for printing 
> access types?

Not directly.  Unchecked_Conversion to an integer type (signed or
unsigned) of the same size, followed by 'Image on the integer type,
is likely to give you what you're probably looking for on most or all
implementations.  Be aware, though, that there's no guarantee that
there is an integer type of the same size as a given access type, or
that all access types are the same size (for example, GNAT uses 64-bit
"fat pointers" for access to unconstrained arrays).

Another possibility is something like this:

   declare
      P: Some_Access_Type := Some_Value;
      package SSE renames System.Storage_Elements;
   begin
      if P = null then
	 Put_Line("P = null");
      else
	 Put_Line("P = " & SSE.Integer_Address'Image
			      (SSE.To_Integer(P.all'Address)));
      end if;
   end;

Note, however, that the value stored in an access object isn't necessarily
the address of the designated object.  It could include or point to a
descriptor, among many other possibilities.

The generic package System.Address_To_Access_Conversions includes a
function to convert from an access type to System.Address, which can then
be converted to an integer type by System.Storage_Elements.To_Integer.
However, System.Address_To_Access_Conversions only uses the access
type Object_Pointer, which it declares itself; it won't operate on an
arbitrary access type.

A more relevant question might be, why do you want to print access types?
If you just want to display them for debugging purposes, a non-portable
solution involving Unchecked_Conversion is probably good enough.
If you have something else in mind, perhaps you're trying to solve the
wrong problem.

-- 
Keith Thompson (The_Other_Keith) kst@thomsoft.com
TeleSoft^H^H^H^H^H^H^H^H Alsys^H^H^H^H^H Thomson Software Products
10251 Vista Sorrento Parkway, Suite 300, San Diego, CA, USA, 92121-2718
This sig uses the word "Exon" in violation of the Communications Decency Act.




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How to print Task_ID type? (GNAT SunOS)
  1996-04-04  0:00   ` Greg Bond
@ 1996-04-05  0:00     ` Robert Dewar
  1996-04-05  0:00     ` Keith Thompson
  1 sibling, 0 replies; 15+ messages in thread
From: Robert Dewar @ 1996-04-05  0:00 UTC (permalink / raw)


Greg asked

"Indeed it is. My oversight. This function does not handle the more
general problem I posed though. Is there a general facility for printing
access types? The GNAT implementation of the Image function above is a
system level (i.e. platform dependent) routine specifically for the
Task_ID type. The only Ada references I've got are Barnes for Ada 95 and
the ALRM, both of which are woefully inadequate on the topic of Ada I/O."

You really must get annex A of the RM, it's quite easy to read (much
easier than the rest of the RM), and is full of useful stuff. You can
pull it off the net, see Ada FAQ for details.

The easiest way to do what you want is:

Integer_Address'Image (To_Integer (Pointer.all'Address))

this is from system.storage_elements

If you want to output the address in hex, then still use
To_Integer(Pointer.all'Addess)
but output the integer value using Text_IO.Modular_IO.Put with
an appropriate base parameter.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How to print Task_ID type? (GNAT SunOS)
  1996-04-05  0:00     ` Keith Thompson
  1996-04-05  0:00       ` Greg Bond
@ 1996-04-05  0:00       ` Robert Dewar
  1996-04-06  0:00         ` Keith Thompson
  1 sibling, 1 reply; 15+ messages in thread
From: Robert Dewar @ 1996-04-05  0:00 UTC (permalink / raw)


Keith said

"Another possibility is something like this:

   declare
      P: Some_Access_Type := Some_Value;
      package SSE renames System.Storage_Elements;
   begin
      if P = null then
         Put_Line("P = null");
      else
         Put_Line("P = " & SSE.Integer_Address'Image
                              (SSE.To_Integer(P.all'Address)));
      end if;
   end;

Note, however, that the value stored in an access object isn't necessarily
the address of the designated object.  It could include or point to a
descriptor, among many other possibilities."

The method is fine, the test for null is appropriate (I missed that
in my message before!) The caution is probably unnecessary, I think
you will find that even in implementations where descriptors etc
are used, that 'Address is likely to point to the data. Remember
that X.all is the value of the type, and 'Address will normally
point to this data. You could make doubly sure in the only case
where there even conceivably could be trouble (arrays), by using

  x.all(x'first)'address

but at this stage, this is getting a bit junky, so even though it is
a bit more complexity, it is probably ceaner to instantiate 
address_to_access conversions to get the adress value.

I tink in GNAT we wlil make 'Img work for pointers, why not? Img is
designed to be helpful in debugging, and this would be helful 
eventually we would like 'Img to work for composite types as well).





^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How to print Task_ID type? (GNAT SunOS)
  1996-04-05  0:00     ` Keith Thompson
@ 1996-04-05  0:00       ` Greg Bond
  1996-04-05  0:00       ` Robert Dewar
  1 sibling, 0 replies; 15+ messages in thread
From: Greg Bond @ 1996-04-05  0:00 UTC (permalink / raw)


Keith Thompson wrote:
> 
> In <31642F61.1D2B@ee.ubc.ca> Greg Bond <bond@ee.ubc.ca> writes:
> [...]
> > Indeed it is. My oversight. This function does not handle the more
> > general problem I posed though. Is there a general facility for printing
> > access types?

<much informed discussion from Keith deleted...>

> A more relevant question might be, why do you want to print access types?
> If you just want to display them for debugging purposes, a non-portable
> solution involving Unchecked_Conversion is probably good enough.
> If you have something else in mind, perhaps you're trying to solve the
> wrong problem.

I'm writing a system level event monitor for GNAT. This is a debugging 
application, but I see no reason why debugging and portability should be 
mutually exclusive.

--
* Greg Bond                         * Dept. of Electrical Eng.  
* email: bond@ee.ubc.ca             * Univ. of British Columbia      
* voice: (604) 822 0899             * 2356 Main Mall                 
* fax:   (604) 822 5949             * Vancouver, BC              
* web: http://www.ee.ubc.ca/~bond   * Canada, V6T 1Z4




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How to print Task_ID type? (GNAT SunOS)
  1996-04-04  0:00 ` Robert Dewar
  1996-04-04  0:00   ` Greg Bond
  1996-04-04  0:00   ` Greg Bond
@ 1996-04-05  0:00   ` Laurent Guerby
  1996-04-04  0:00     ` Joel Sherrill
  2 siblings, 1 reply; 15+ messages in thread
From: Laurent Guerby @ 1996-04-05  0:00 UTC (permalink / raw)


Greg Bond writes
: Indeed it is. My oversight. This function does not handle the more 
: general problem I posed though. Is there a general facility for printing 
: access types? 

   No,  like in C you have  to convert them to  an integer type before
printing  them  using your  favourite  output routine   (printf or Put
;-).  This can be done in  "portable" Ada 95  (as far as  this kind of
game can be tagged as portable ...) :

   1. Instanciate System.Address_To_Access_Conversions for your object
   type, RM95-13.7.2.

   2. Use System.Storage_Elements.To_Integer to convert your Address
   to an implementation defined integer type, System.Storage_Elements. 
   Integer_Address, RM95-13.7.1.

   3. Use the Image attribute on this integer type. You can't use
   Text_IO.Integer_IO because the type can be a signed or modular integer
   type, RM95-13.7.1(13).

   4. Put (The_Resulting_String); --  !!

[Note: if you  want to do low  level manipulation, you've to cope with
chapter 13, and with 13.7 "The package System",  no other way, I think
most books, for many good reasons, don't talk about that.]

[Note 2 : I give  my vote for  chapter 13 as less human-comprehensible
part of the RM ;-]

[Note 3 : guess where you  find  the more  annotation in the annotated
reference manual ;-]

   Of course, if you're using GNAT (available  freely on most platform
used by  normal  human with  a keyboard  ;-), you can  safely use your
knowledge of the particular GNAT implementation ("Use the Source", see
my signature ;-).  And, as documented, all GNAT  basic types are the
same as their C equivalent ;-).

: The GNAT implementation of the Image function above is a 
: system level (i.e. platform dependent) routine specifically for the 
: Task_ID type. The only Ada references I've got are Barnes for Ada 95 and 
: the ALRM, both of which are woefully inadequate on the topic of Ada I/O.

   I don't share  your point of view  (both on Barnes  and on the RM95
;-).  You can do plenty  of things if  you take the  time to read  the
Text_IO  description in the RM (83  and 95), and  incredible things if
you take time to read the Stream section of the RM95 ;-).

-- 
--  Laurent Guerby, student at Telecom Bretagne (France), Team Ada
--  "Use the Source, Luke. The Source will be with you, always (GPL)"
--  http://www-eleves.enst-bretagne.fr/~guerby/ (GATO Project)
--  Try GNAT, the GNU Ada 95 compiler (ftp://cs.nyu.edu/pub/gnat)




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How to print Task_ID type? (GNAT SunOS)
  1996-04-05  0:00       ` Robert Dewar
@ 1996-04-06  0:00         ` Keith Thompson
  1996-04-06  0:00           ` Robert Dewar
  1996-04-07  0:00           ` Keith Thompson
  0 siblings, 2 replies; 15+ messages in thread
From: Keith Thompson @ 1996-04-06  0:00 UTC (permalink / raw)


In <dewar.828713391@schonberg> dewar@cs.nyu.edu (Robert Dewar) writes:
[...]
> The method is fine, the test for null is appropriate (I missed that
> in my message before!) The caution is probably unnecessary, I think
> you will find that even in implementations where descriptors etc
> are used, that 'Address is likely to point to the data. Remember
> that X.all is the value of the type, and 'Address will normally
> point to this data.

One would think so, but I just tried an experiment with one
particular Ada 83 compiler.  For an object P declared as an access to
unconstrained String, P and P.all'Address have the same value (when
Uncheckedly_Converted to an integer type), but P(P'First)'Address has
a different value.  It turns out that P points to a descriptor, and
P(P'First)'Address is the address of the first character of the string
itself.

This should probably (almost certainly) be considered a bug in that
compiler's implementation of P.all'Address, which should be the address
of the string, not of the descriptor.

>                     You could make doubly sure in the only case
> where there even conceivably could be trouble (arrays), by using
> 
>   x.all(x'first)'address

Which will raise Constraint_Error if X.all is a null array.  For what I
suspect is the most common application for this kind of thing, interfacing
to C, this shouldn't matter, since C doesn't have null arrays (though
future versions of the C standard might).  (Incidentally, the ".all" in
the above expression is optional.)

> but at this stage, this is getting a bit junky, so even though it is
> a bit more complexity, it is probably ceaner to instantiate 
> address_to_access conversions to get the adress value.

How does Address_To_Access_Conversions help in this case?  It only
lets you convert between System.Addess and an access type declared in
Address_To_Access_Conversions; it doesn't provide operations on arbitrary
user-declared access types.

-- 
Keith Thompson (The_Other_Keith) kst@thomsoft.com
TeleSoft^H^H^H^H^H^H^H^H Alsys^H^H^H^H^H Thomson Software Products
10251 Vista Sorrento Parkway, Suite 300, San Diego, CA, USA, 92121-2718
This sig uses the word "Exon" in violation of the Communications Decency Act.




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How to print Task_ID type? (GNAT SunOS)
  1996-04-04  0:00     ` Joel Sherrill
@ 1996-04-06  0:00       ` Fergus Henderson
  1996-04-06  0:00         ` Robert Dewar
  0 siblings, 1 reply; 15+ messages in thread
From: Fergus Henderson @ 1996-04-06  0:00 UTC (permalink / raw)


joel@redstone.army.mil (Joel Sherrill) writes:

> I am not sure what the origin of the "%p" printf specifier is but it is
> present for all the C libraries I use.  With it, you can:
>
>   printf( "The address of X is %p\n", &X );

Incidentally, that code fragment has undefined behaviour.
You need to write

    printf( "The address of X is %p\n", (void *) &X );

This is because the C standard allows implementations to represent different
pointer types differently.

(What relevance does this have to comp.lang.ada?  Just another example
of how easy it is to shoot yourself in the foot in languages with less
compile-time and run-time checking.)

--
Fergus Henderson <fjh@cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3         |     -- the last words of T. S. Garp.




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How to print Task_ID type? (GNAT SunOS)
  1996-04-06  0:00         ` Keith Thompson
@ 1996-04-06  0:00           ` Robert Dewar
  1996-04-07  0:00           ` Keith Thompson
  1 sibling, 0 replies; 15+ messages in thread
From: Robert Dewar @ 1996-04-06  0:00 UTC (permalink / raw)


iKeith said:

"How does Address_To_Access_Conversions help in this case?  It only
lets you convert between System.Addess and an access type declared in
Address_To_Access_Conversions; it doesn't provide operations on arbitrary
user-declared access types."

I agree this is a nuisance, which is why I prefer to avoid using this,
but what one would have to do is to replace all declarations of 
access types that one wanted to print by instantiations of this package,
and then rename the access type from inside the pacage.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How to print Task_ID type? (GNAT SunOS)
  1996-04-06  0:00       ` Fergus Henderson
@ 1996-04-06  0:00         ` Robert Dewar
  0 siblings, 0 replies; 15+ messages in thread
From: Robert Dewar @ 1996-04-06  0:00 UTC (permalink / raw)


Fergus says

"This is because the C standard allows implementations to represent different
pointer types differently."

That's true, but in practice very rarely taken advantage of.

The Ada standard permits this too of course, and GNAT does take advantage
of this (using double width pointers for pointers to unconstrained
arrays).

It is surprising how MUCH Ada code out there relies on the assumption
that all pointers are the same size as addresses. n fact we ran into this
so often in GNAT, that now GNAT allows you to specify the size of an
access type, and force this to be true if you want it, e.g.

    type g is access string;
    for g'size use address'size;

This representation is less time efficient but lots of existing Ada code
had this assumption deeply built in.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How to print Task_ID type? (GNAT SunOS)
  1996-04-06  0:00         ` Keith Thompson
  1996-04-06  0:00           ` Robert Dewar
@ 1996-04-07  0:00           ` Keith Thompson
  1 sibling, 0 replies; 15+ messages in thread
From: Keith Thompson @ 1996-04-07  0:00 UTC (permalink / raw)


In <DpF82v.FBz@thomsoft.com> I wrote:
[...]
> How does Address_To_Access_Conversions help in this case?  It only
> lets you convert between System.Addess and an access type declared in
> Address_To_Access_Conversions; it doesn't provide operations on arbitrary
> user-declared access types.

There's something else that I had forgotten until just a few minutes ago.
Ada 95 allows conversions between access types in some cases, particularly
when the target is a general access type (one declared with "access
constant" or "access all"), as long as the designated types are the same.
(It's more complicated than that; see RM95 4.6 for details.)

Since the type Object_Pointer in System.Adddress_To_Access_Conversions
is a general access type, you can convert other access types to it.

Thus the following generic Image function for access types will work
in most cases.  (Assume with clauses for System.Storage_Elements and
System.Address_To_Access_Conversions).

   generic
      type Object(<>) is limited private;
      type Pointer is access Object;
   function Image(Item: Pointer) return String;
 
   function Image(Item: Pointer) return String is
      package SSE renames System.Storage_Elements;
      package Conv is new System.Address_To_Access_Conversions(Object);
   begin
      return SSE.Integer_Address'Image
                (SSE.To_Integer
                    (Conv.To_Address
                        (Conv.Object_Pointer(Item))));
   end Image;

For example:

   declare
      type Pointer is access Integer;
      function Pointer_Image is new Image(Integer, Pointer);
      P0: Pointer := null;
      P1: Pointer := new Integer'(42);
   begin
      Put_Line("P0 = " & Pointer_Image(P0));
      Put_Line("P1 = " & Pointer_Image(P1));
   end;

Some things to be aware of:

1. This won't work for "access constant" types.

2. This won't work for access-to-subprogram types (but then I don't
   think anything short of Unchecked_Conversion will).

3. This won't work if the access type declaration is nested too deeply.
   It can't be deeper than the declaration of either the instantiation
   of Image or Image itself.

4. The image of a null access value will be some implementation-dependent
   integer literal.  It's very likely to be 0, but this isn't guaranteed.

5. Robert Dewar's suggestion of using P.all'Address is almost certainly
   good enough in most cases, as long as you first check that P /= null.
   It also works for "access constant" types and nested types.  So why
   am I bothering to post this?  8-)}

6..N. Numerous other things I haven't thought of; I should probably know
      better than to post at this hour.

-- 
Keith Thompson (The_Other_Keith) kst@thomsoft.com
TeleSoft^H^H^H^H^H^H^H^H Alsys^H^H^H^H^H Thomson Software Products
10251 Vista Sorrento Parkway, Suite 300, San Diego, CA, USA, 92121-2718
This sig uses the word "Exon" in violation of the Communications Decency Act.




^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~1996-04-07  0:00 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-04-03  0:00 How to print Task_ID type? (GNAT SunOS) Greg Bond
1996-04-04  0:00 ` Robert Dewar
1996-04-04  0:00   ` Greg Bond
1996-04-04  0:00   ` Greg Bond
1996-04-05  0:00     ` Robert Dewar
1996-04-05  0:00     ` Keith Thompson
1996-04-05  0:00       ` Greg Bond
1996-04-05  0:00       ` Robert Dewar
1996-04-06  0:00         ` Keith Thompson
1996-04-06  0:00           ` Robert Dewar
1996-04-07  0:00           ` Keith Thompson
1996-04-05  0:00   ` Laurent Guerby
1996-04-04  0:00     ` Joel Sherrill
1996-04-06  0:00       ` Fergus Henderson
1996-04-06  0:00         ` Robert Dewar

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