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=0.6 required=5.0 tests=BAYES_00,LOTS_OF_MONEY, TO_NO_BRKTS_FROM_MSSP autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,958ed45cc4906b53 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-31 13:26:10 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!feed.textport.net!newsranger.com!www.newsranger.com!not-for-mail Newsgroups: comp.lang.ada From: Ted Dennison References: Subject: Re: Distributed system portability Message-ID: X-Abuse-Info: When contacting newsranger.com regarding abuse please X-Abuse-Info: forward the entire news article including headers or X-Abuse-Info: else we will not be able to process your request X-Complaints-To: abuse@newsranger.com NNTP-Posting-Date: Tue, 31 Jul 2001 16:26:02 EDT Organization: http://www.newsranger.com Date: Tue, 31 Jul 2001 20:26:02 GMT Xref: archiver1.google.com comp.lang.ada:10891 Date: 2001-07-31T20:26:02+00:00 List-Id: In article , tmoran@acm.org says... > >>you have to do *all* this (including implementing all the stream attributes for >>*all* types that will ever be used with the stream, excepting perhaps some >>composite types). With that much work involved, the streams aren't really >>providing you much except the supposedly nice syntax. > (I haven't tried this but ...) I think you just have to implement the >base types, and you need do it only once. So if you are going to be I have actually done some cross-platform (and cross-vendor) stream work. The approach you mention has the following problems: a) Not all discrete types are predefined. Integer types need not be derived from Integer, and then there's modular types and enumerations. I'd particularly expect to see different sizes used for enumerations. Some compilers might put small ones in a byte, while others would use whatever their machine word is. b) 'Output, 'Input, 'Class'Output, and 'Class'Input must deal with discriminants and unconstrained arrays. The standard says the discriminant/array length has to be written first, but says nothing about how many bytes are used to do it. The discriminant should probably get written using its type's 'Write, but there is no such thing for unconstrained array lengths. Thus you must rewrite 'Input, 'Output, 'Class'Input, and 'Class'Output for all such types (or at least all unconstrained array types, and the 'Write for all the discriminats on the discriminated ones). c) 'Class'Output and 'Class'Input on tagged types also have to deal with the tag. This is done using Tags.Internal_Tag. You can specify the external tag for a tagged type, but not the internal tag. Thus in order to write tagged types portably, you have to provide your own version of 'Class'Output and 'Class'Input for every tagged type. Among other nasty problems, this involves creating an algorithm that can come up with a portable unique tag for any type that might ever get derived from your tagged type. Think on that one for a while... d) One of the compilers I tried this on would not allow attribute definition clauses outside of the declarative section that contained the type in question's definition. That means that any clause for the predefined types would have to be written in Standard (which you cannot change, as per the standard). I don't know if this was allowable behavior, required behavior, or a bug. e) The streams themselves have to be implemented portably (eg: a series of Ada.Streams.Write's on one outputs the same bit pattern in the same order that it does on any other). This is mostly only a problem with user-created streams, as the predefined ones don't seem to leave much room for internal data manipulation. --- T.E.D. homepage - http://www.telepath.com/dennison/Ted/TED.html home email - mailto:dennison@telepath.com