comp.lang.ada
 help / color / mirror / Atom feed
* Record aggregate question (language lawyer needed!)
@ 1996-06-21  0:00 mcriley on BIX
  1996-06-21  0:00 ` Norman H. Cohen
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: mcriley on BIX @ 1996-06-21  0:00 UTC (permalink / raw)




The following test program is accepted without question by one Ada
compiler and executes without any qualms, while another warns of
a constraint_error at runtime.  Which is correct, or, is the exact
implementation left up to the compiler implementor?

procedure Rec_Test is

   type Task_Record_Type is
	record
	    Originator : String (1 .. 20);
	    Header_Dtg : String (1 .. 12);
	end record;
	
    Task_Record : Task_Record_Type := (others => (others => ' '));

begin
  null;
end rec_test;

The relevant part of the LRM is 4.3.1[1]: "A component association
with the choice others [...] is only allowed if the represented
components are all of the same type."  Well the components are
both of the same _type_, but obviously the subtype constraints vary.
The nature of the warning produced by the one compiler reflects
that: "Subtype_Match_Error".

Any input on this would be most appreciated.

Marc A. Criley




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

end of thread, other threads:[~1996-06-25  0:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-06-21  0:00 Record aggregate question (language lawyer needed!) mcriley on BIX
1996-06-21  0:00 ` Norman H. Cohen
1996-06-21  0:00 ` Robert A Duff
1996-06-21  0:00 ` Theodore E. Dennison
1996-06-22  0:00   ` Robert A Duff
1996-06-24  0:00   ` Norman H. Cohen
1996-06-24  0:00   ` Philip Brashear
1996-06-25  0:00     ` Theodore E. Dennison

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