comp.lang.ada
 help / color / mirror / Atom feed
From: Martin <martin.dowie@btopenworld.com>
Subject: Re: Interfacing with C ; an ununsed fields dilemma
Date: Thu, 2 Jul 2009 03:16:14 -0700 (PDT)
Date: 2009-07-02T03:16:14-07:00	[thread overview]
Message-ID: <de77ea5e-47ea-4a94-a736-a8e214d8924c@x17g2000yqd.googlegroups.com> (raw)
In-Reply-To: 4a4c8333$0$32672$9b4e6d93@newsspool2.arcor-online.net

On Jul 2, 10:51 am, Georg Bauhaus <rm.dash-bauh...@futureapps.de>
wrote:
> 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);

pragma Zero_Fill sounds interesting...but it isn't standard :-(

Cheers
-- Martin



  reply	other threads:[~2009-07-02 10:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-02  6:20 Interfacing with C ; an ununsed fields dilemma Hibou57 (Yannick Duchêne)
2009-07-02  9:25 ` Martin
2009-07-02 18:14   ` reserved fields; was " tmoran
2009-07-02  9:45 ` Maciej Sobczak
2009-07-02 12:01   ` Hibou57 (Yannick Duchêne)
2009-07-02 12:09     ` Georg Bauhaus
2009-07-02 13:21       ` Hibou57 (Yannick Duchêne)
2009-07-02 15:50         ` Georg Bauhaus
2009-07-02 14:52     ` Maciej Sobczak
2009-07-02 23:21       ` Hibou57 (Yannick Duchêne)
2009-07-03  7:21         ` Maciej Sobczak
2009-07-02  9:51 ` Georg Bauhaus
2009-07-02 10:16   ` Martin [this message]
2009-07-02 11:48     ` Hibou57 (Yannick Duchêne)
2009-07-02 15:55 ` Robert A Duff
2009-07-04  0:03   ` Randy Brukardt
2009-07-03  6:59 ` anon
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox