comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Interfacing between Ada and C: records and structs
Date: Tue, 31 Jul 2012 23:46:34 +0300
Date: 2012-07-31T23:46:34+03:00	[thread overview]
Message-ID: <a7quhbFq2eU1@mid.individual.net> (raw)
In-Reply-To: <38e1e122-b788-4863-88ce-6b1fd5372e43@googlegroups.com>

On 12-07-31 22:44 , awdorrin wrote:
> This is code from the POSIX Florist API for Ada. There is a comment
> in the code that says that the 'Dummy' tagged null record is: "to
> force by-reference parameter mode"

Perhaps, in some earlier GNAT, a "tagged null record" would have a zero
size, but the same is not true in the current GNAT.

If the goal is to force passing by reference, another way is to make the
Mutex type limited:

   type Mutex is limited record
      Mutex : aliased POSIX.C.pthread_mutex_t;
   end record;

Being "limited" should not increase the size of the record. But it
forbids some operations on the type, chiefly ":=".

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
      .      @       .



  reply	other threads:[~2012-08-06 14:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-31 16:38 Interfacing between Ada and C: records and structs awdorrin
2012-07-31 17:16 ` Niklas Holsti
2012-07-31 18:44   ` awdorrin
2012-07-31 19:08     ` awdorrin
2012-07-31 19:27       ` Simon Wright
2012-07-31 19:44         ` awdorrin
2012-07-31 20:46           ` Niklas Holsti [this message]
2012-08-01 12:16             ` awdorrin
2012-07-31 19:23     ` Simon Wright
2012-08-02  4:39     ` Shark8
2012-08-02 12:32       ` awdorrin
     [not found] <7beb59ba-ca6f-476e-8b39-604196b0b79f@googlegroups.com>
2012-08-01  2:51 ` Jeffrey Carter
replies disabled

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