comp.lang.ada
 help / color / mirror / Atom feed
From: Charles Hixson <charleshixsn@earthlink.net>
Subject: Circular type definition problem
Date: Mon, 11 Jun 2001 17:44:29 GMT
Date: 2001-06-11T17:44:29+00:00	[thread overview]
Message-ID: <1s7V6.4021$Il5.510814@newsread1.prod.itd.earthlink.net> (raw)

This is what I'm trying to do:
        type Block;
        package Node_IO is      new Ada.Direct_IO(Block);
        use     Node_IO;
        type    BlockData       is      array (0..511) of Byte;
        type    Block   is      record
                next_node       :       Node_IO.Count;
                data                    :       BlockData;
        end record;     --      Block
        pragma pack(BlockData);
        pragma pack(Block);

Not too much to my surprise, it didn't work.  Node_IO needs to be 
defined with a real type.  OTOH, the type Node_IO.Count is 
defined within Node_IO, so I can't put it after the declaration 
of Block.

I suppose that I could just give up, and declare next_node to be 
Long_Integer, but that seems so inelegant.  Node_IO.Count is, 
essentially, an Access variable (it says where in the file to 
find the next Block).  But I'm not really sure how to approach 
this.  Any suggestions?



             reply	other threads:[~2001-06-11 17:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-11 17:44 Charles Hixson [this message]
2001-06-11 20:16 ` Circular type definition problem Martin Dowie
2001-06-11 21:18   ` Charles Hixson
replies disabled

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