comp.lang.ada
 help / color / mirror / Atom feed
* Ambiguous use of dereference in Ada
@ 1985-07-22 14:06 rosen
  1985-07-24 14:41 ` Joe Orost
  0 siblings, 1 reply; 2+ messages in thread
From: rosen @ 1985-07-22 14:06 UTC (permalink / raw)




I have noted an unusually item while writting some Ada code.  This strange
item involved the dereference operator 'all' for use with access types.  See
the following piece of code:

--------------------------------------------------------------
  procedure weird_ptrs is

     type stupid is 
       record
	 a: integer;
	 b: float;
       end record;

     type stupid_ptr is access stupid;

     c1, c2: integer;
     xxx: stupid_ptr;

  begin
        xxx := new stupid'(a => 100, b => 3.1415);
        c1 := xxx.a;		--1--
        c2 := xxx.all.a;	--2--

  end weird_ptrs;
---------------------------------------------------------------------------


The compiler (Verdix 4.02) does not complain about lines --1-- and --2--.
Actually they appear to be exactly the same.   In --1-- the dereference
operation is implicit while in --2-- the deference operation is performed
through the 'all' operator.  I find this to be extremely strange even
thought I can accept both methods.  What bothers me is that the LRM is very
vague about mentioning any difference between these two methods.  This
certainly can be very confusing when reading code.  Does anybody have any
thoughts on why this is?  I don't believe it is a bug, but please let me
know if there is a compiler that has something to say about this.


Steve Rosen
Siemens Research and Technology Laboratories
Princeton, NJ

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

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

end of thread, other threads:[~1985-07-24 14:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1985-07-22 14:06 Ambiguous use of dereference in Ada rosen
1985-07-24 14:41 ` Joe Orost

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