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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ae40b60d59bcdc4b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-11 12:02:23 PST Path: supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!newsfeed1.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3AD49CB1.9160D850@earthlink.net> From: "Marc A. Criley" Organization: Quadrus Corporation X-Mailer: Mozilla 4.73 [en] (X11; U; Linux 2.2.14-5.0 i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada Examples and Problems References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Wed, 11 Apr 2001 19:01:42 GMT NNTP-Posting-Host: 158.252.123.155 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 987015702 158.252.123.155 (Wed, 11 Apr 2001 12:01:42 PDT) NNTP-Posting-Date: Wed, 11 Apr 2001 12:01:42 PDT X-Received-Date: Wed, 11 Apr 2001 12:00:26 PDT (newsmaster1.prod.itd.earthlink.net) Xref: supernews.google.com comp.lang.ada:6780 Date: 2001-04-11T19:01:42+00:00 List-Id: "chris.danx" wrote: > > This is something i'm going to have to watch out for in future. I've got an > idea about how to limit the chances of me running into this again. I'm > going to put a function for every type i might write to a stream (that's not > dynamic in size) that gives the size of it's contents. > > -- a function that returns the total size of all fields in type X; > -- > function size_of_fields(t : in X) return natural; > > Not the best option but certainly better than hardwiring it into the > file/stream handling routines. This just reminded me of a thread that was raging here for awhile last year regarding the 'Size of types and objects versus the number of bytes objects occupy in a stream (stream meaning the Stream_IO kind of stream). Bottom line: There is _no_ required correspondence between those sizes. This can be frustrating at times, and did engender some smoke and fire in the newsgroup. There are situations where one wants to know ahead of time how many bytes something is going to occupy in a stream, but Ada does not require that an ability to make that determination for all types be available. Marc A. Criley Senior Staff Engineer Quadrus Corporation www.quadruscorp.com