comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Interfacing with C ; an ununsed fields dilemma
Date: Thu, 02 Jul 2009 17:50:14 +0200
Date: 2009-07-02T17:50:15+02:00	[thread overview]
Message-ID: <4a4cd737$0$31877$9b4e6d93@newsspool3.arcor-online.net> (raw)
In-Reply-To: <9d9b5fe7-c990-4c67-9c6e-1dacd484b296@t21g2000yqi.googlegroups.com>

Hibou57 (Yannick Duch�ne) schrieb:
> On 2 juil, 14:09, Georg Bauhaus <rm.dash-bauh...@futureapps.de> wrote:
> 
>> In case you are using current Ada, have you considered
>> making your type limited an use a "construtor function"?http://www.adacore.com/2007/05/28/gem-3/
> 
> But this still allow an automatic instantion without the required
> initialization.

No, if you use (<>) in the public view of the type as explained
in Gem #3 then users will have to initalize explicitly;
the only possibility to declare an object of the type, then,
is together with call a public "constructor function" to do
the initalization in place.



> I oftenly feel the same, and I would probably have choose this design
> if I were to create a specification from the ground up (perhaps I'm
> driven into error by the existing C interface). Reading it in this
> context, make me think that perhaps I should use a more abstract
> specification, thus make these types (there are numerous records of
> the same kind) fully private and define numerous accessors to each of
> these types. I will no more bother to declare these unused fields, as
> this would be now in the private part.

Private or not, "uncontrolled" unused bits may have an impact
on future translations (see the reasons Maciej
has listed).  In the private part of a package, then,

(a) users of its public part will not need to consider
the record's representation,

(b) but you can be specific (open, honest, ...) about the
components not used, and whether or not you want them
to be initialized by default etc.



  reply	other threads:[~2009-07-02 15:50 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 [this message]
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
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