From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,35d56f705b196731 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Building portable data structure (NOT a newbie question?) Date: 1996/12/27 Message-ID: #1/1 X-Deja-AN: 206256337 references: organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-12-27T00:00:00+00:00 List-Id: In article , wrote: >Using streams seems to be the solution. Yes, probably. >... Maybe this is a red herring and >that is why I have not found a good solution yet, but I think not. >Unfortunately, I can find no way to override the predefined types 'READ >'WRITE, "INPUT, and 'OUTPUT attributes. Right, you're not allowed to define Integer'Read and whatnot. >...This would really solve it. Of >course I could write one of those hated units with new definitions of >integer, natural, float, etc in them, but I hated that in Ada 83 so I am >sure I will hate it in Ada 95. Once you make on of those things you have >to always be dragging it around with a with clause then a use clause for >the operators and stuff. Heck, if I want to do that I would with and use >the predefined unit. One thing you can do is put a whole lot of code in child units of a given unit. E.g. you might have: package Basic_Types is ... -- defines your version of Integer and so forth end; with Basic_Types; use Basic_Types; package My_Application is end; -- empty package Then put all the rest of your code under My_Application. Then, My_Application.This_Package and My_Application.That_Package can all see the stuff in Basic_Types without explicitly having to "with" and "use" it. Bit_Order specifications are not required on most machines, by the way. Only on word-addressable machines. This is because on byte-addressable machines, they can cause gaps within components, which is a pain for the compiler. GNAT might implement them someday, though -- ask ACT. A sensible thing to might be to implement the non-default Bit_Order, but only in the cases where there are no gaps (which is probably your case). >Then I realized that the output from the streams units may not, and in >fact are not, be protable because the type element defined in streams is >platform or implementation independent. But, if I can get everything >uniform in a stream, I can convert the stream to a fixed stream >(ie: a byte stream where the element is always defined as mod 8). I suspect that Stream_Elements will always be 8 bits, except on unusual systems. - Bob