comp.lang.ada
 help / color / mirror / Atom feed
From: rosen@gypsy.UUCP
Subject: Ambiguous use of dereference in Ada
Date: Mon, 22-Jul-85 10:06:00 EDT	[thread overview]
Date: Mon Jul 22 10:06:00 1985
Message-ID: <38000019@gypsy.UUCP> (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

             reply	other threads:[~1985-07-22 14:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1985-07-22 14:06 rosen [this message]
1985-07-24 14:41 ` Ambiguous use of dereference in Ada Joe Orost
replies disabled

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