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-Thread: a07f3367d7,5afd69f1373c41cc X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,CP1252 Path: g2news2.google.com!postnews.google.com!x17g2000yqd.googlegroups.com!not-for-mail From: Martin Newsgroups: comp.lang.ada Subject: Re: Interfacing with C ; an ununsed fields dilemma Date: Thu, 2 Jul 2009 03:16:14 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <4a4c8333$0$32672$9b4e6d93@newsspool2.arcor-online.net> NNTP-Posting-Host: 20.133.0.8 Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1246529774 23677 127.0.0.1 (2 Jul 2009 10:16:14 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 2 Jul 2009 10:16:14 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: x17g2000yqd.googlegroups.com; posting-host=20.133.0.8; posting-account=g4n69woAAACHKbpceNrvOhHWViIbdQ9G User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:6793 Date: 2009-07-02T03:16:14-07:00 List-Id: On Jul 2, 10:51=A0am, Georg Bauhaus wrote: > Hibou57 (Yannick Duch=EAne) schrieb: > > > > > Hello to all, > > > Once again, a topic about interfacing with C structures. > > > A lot of C structure are defined with so called =93 unused field > > reserved for future use =94 (oftenly never used in any future). This > > fields are generally to be initialized to zero, what is required, to > > unsure it will not be errorneously interpreted by the exogenous part > > of the application, specially if it is dynamically linked to the > > application (beceause then, its version or its implementation may be > > differente and unknown of the application which rely on it). > > > And here is the dilemma : > > > Using clause representation, it is tempting to simply drop this > > unuseful unusedfields from the visible part of the declaration (yeah > > dear friend, lot cleaner, really tempting), > > Omitting things might be acceptable in mathematical > discourse, but actually writing things down helps a > lot in programming, at least it helps me as a reader, > not up for solving (inter-)language puzzles. > You explanation of the record's gap fields is itself a hint > that these components do need some attention. > Shouldn't therefore Martin's example be the way to go? > > This has been discussed before, topics included > > =A0 =A0for X use all > =A0 =A0 =A0 record > =A0 =A0 =A0 =A0 =A0... > =A0 =A0 =A0 end record; > > pragma Zero_Fill and Unchecked_Conversion (for setting bits to 0); pragma Zero_Fill sounds interesting...but it isn't standard :-( Cheers -- Martin