comp.lang.ada
 help / color / mirror / Atom feed
* Attempting to modify a function result
@ 1999-07-22  0:00 Raymond C. Rawa
  1999-07-22  0:00 ` Pascal MALAISE
  1999-07-22  0:00 ` Robert I. Eachus
  0 siblings, 2 replies; 8+ messages in thread
From: Raymond C. Rawa @ 1999-07-22  0:00 UTC (permalink / 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?




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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-22  0:00 Attempting to modify a function result Raymond C. Rawa
1999-07-22  0:00 ` 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

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