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!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Thu, 02 Jul 2009 11:51:46 +0200 From: Georg Bauhaus User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Interfacing with C ; an ununsed fields dilemma References: In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Message-ID: <4a4c8333$0$32672$9b4e6d93@newsspool2.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 02 Jul 2009 11:51:47 CEST NNTP-Posting-Host: 49b1a53e.newsspool2.arcor-online.net X-Trace: DXC=3<8]YY^4mdm]l@YUW5NBknA9EHlD;3Ycb4Fo<]lROoRa^YC2XCjHcbiDiF:K0ILb8a;9OJDO8_SKfNSZ1n^B98ijW:^fnN3`T Hibou57 (Yannick Duch�ne) schrieb: > Hello to all, > > Once again, a topic about interfacing with C structures. > > A lot of C structure are defined with so called � unused field > reserved for future use � (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 for X use all record ... end record; pragma Zero_Fill and Unchecked_Conversion (for setting bits to 0);