comp.lang.ada
 help / color / mirror / Atom feed
* Discriminant within discriminants
@ 2006-05-03  1:49 stuart clark
  2006-05-03 16:45 ` Jeffrey R. Carter
  2006-05-05  9:03 ` Stephen Leake
  0 siblings, 2 replies; 8+ messages in thread
From: stuart clark @ 2006-05-03  1:49 UTC (permalink / raw)


I have a the following

package message_types

  type id_type is range 1..8;

 type dispense_ack (size:id_type:=id_Type'first) is
   record
     dispense_acks:array(1..size) of acks;
   end record;

  type message_types(dispense_acknowledgement, dispense_request);

  type in_messages(kind :msg_types:=msg_types'first) is
   record
    case type is
      when dispense_acknowledgement =>
         acknowledgements:dispense_ack;
      when dispense_request
         request:integer;
    end case
  end record;

end message_types;

i want to declare a message that is of dispense_acknowledgment type
with a size of 8

i can do

msg:message_types.in_messages(kind=>message_types.dispense_acknowledgment);

this gives me the correct message type but as the dispense_ack is
defaulted to size=1
i get a message of size 1.

the only way i can get my code to compile with a message size of 8 is
to use

declare
  msg:message_types.in_messages;
  dispense_ack_msg:message_types.dispense_ack(size=>8);
begin
  msg:=(kind=>message_types.dispense_acknowledgement,
            acknowledgements=>dispense_ack_msg);

end;

QUESTION : can i declare a message with a type and size in the one
statement without using the intermediate message.




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

end of thread, other threads:[~2006-05-05  9:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-03  1:49 Discriminant within discriminants stuart clark
2006-05-03 16:45 ` Jeffrey R. Carter
2006-05-03 21:05   ` Randy Brukardt
2006-05-04  0:14     ` stuart clark
2006-05-04  0:57       ` Jeffrey R. Carter
     [not found]         ` <4a9k52ha4ohqkcd01ghn6c7785d6pvf91e@4ax.com>
2006-05-04 17:57           ` Jeffrey R. Carter
2006-05-04  0:45     ` Jeffrey R. Carter
2006-05-05  9:03 ` Stephen Leake

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