comp.lang.ada
 help / color / mirror / Atom feed
* subaggragates
@ 1986-02-09 21:56 Roger Racine
  0 siblings, 0 replies; only message in thread
From: Roger Racine @ 1986-02-09 21:56 UTC (permalink / raw)


In regard to the following question:
Hi all,

We have a question concerning subaggregates.  Consider the following
program...

	procedure Agg is
	    type R is
		record
		    X : String (1 .. 2) := (others => 'z');
		    Y : String (5 .. 6) := (others => 'z');
		end record;
	     A : R;
	begin
	    A := (others => (others => 'a'));
	    A := (X | Y => (others => 'a'));
	    A := ((others => 'c'), (others => 'c'));
	end Agg;

Now the question is:  Should any of these assignments raise
Constraint_Error?  The Data General raises Constraint_Error on the
first two but not on the third.   Is the subaggregate
	(others => 'a')
in the first (and second) assignment evaluated once or twice?
Do things change if the components X and Y are of different lengths?



thanks in advance to anybody who has the slightest idea,

doug bryan   and    Geoff Mendal
-------

-----------------------------------------------------------------------

All three work fine on DEC's Ada compiler.

The "expression" (in your case 'a') is evaluated separately for
each component assigned (i.e. 4 times total per assignment statement).

It should not matter how many characters are in each string.

I hope that helps. I did not try to find the LRM paragraph,
but believe the DEC compiler is correct.

Roger Racine
-------

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1986-02-09 21:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1986-02-09 21:56 subaggragates Roger Racine

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