comp.lang.ada
 help / color / mirror / Atom feed
From: "Raymond C. Rawa" <Raymond.C.Rawa@nospam.boeing.com>
Subject: Attempting to modify a function result
Date: 1999/07/22
Date: 1999-07-22T00:00:00+00:00	[thread overview]
Message-ID: <3797103C.4FD5@nospam.boeing.com> (raw)

I've encountered a "feature" of Ada83 or the VADS compiler that I don't
understand.

I discovered this little feature while unit testing a package that
contained a typo.

   package Foo is

      Display_Type is record
         a : integer;
         b : float;
      end record;

      function Display return Display_Type;

      procedure Huh;

   end Foo;

   package body Foo is

      The_Display : Display_Type; 
      --% internal object

      function Display return Display_Type is
      begin
         return The_Display;
      end Display;

      procedure Huh is
      begin
         Display.a := 5; -- I mean't to type: The_Display.a := 5;
      end Huh;
   end Foo;

The procedure Foo.Huh compiles and executes without error.  As a side
note, The_Display is unchanged by this procedure.

Can someone please explain what's going on here?




             reply	other threads:[~1999-07-22  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-22  0:00 Raymond C. Rawa [this message]
1999-07-22  0:00 ` Attempting to modify a function result Pascal MALAISE
1999-07-23  0:00   ` Raymond C. Rawa
1999-07-22  0:00 ` Robert I. Eachus
1999-07-22  0:00   ` Keith Thompson
1999-07-23  0:00     ` John Herro
1999-07-26  0:00   ` Tucker Taft
1999-07-27  0:00     ` Ehud Lamm
replies disabled

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