comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adambeneschan@aol.com>
Subject: Re: Gnat's Handling of Record with Address Clause
Date: Thu, 26 Sep 2013 08:21:34 -0700 (PDT)
Date: 2013-09-26T08:21:34-07:00	[thread overview]
Message-ID: <78f1eefc-8289-4afc-80c6-04aec1f26b7e@googlegroups.com> (raw)
In-Reply-To: <ebe1ec4d-5cf2-49ac-84fe-9fea4da744ee@googlegroups.com>

On Thursday, September 26, 2013 8:05:17 AM UTC-7, Eryndlia Mavourneen wrote:

> Since the "Message" parameter is an address, I assume that you mean declaring an access type for My_Buffer_T, then doing the address -> access conversion for an access variable on that type.  

Yes.

> A lot of work to get around this Gnat issue.  

I think using System.Access_To_Address_Conversions is the right way to do it, regardless of whose compiler you're using.  Using an Address aspect on a discriminant record type like this is going to be problematic, without a specific language feature to support it.  As you found out, the language doesn't let you declare objects of indefinite types without specifying the constraints, even if you have an Address aspect; but if you do specify the discriminant constraint, what do you put for the constraint, given that the correct value will be something that has to be read from memory?  So there are language design issues involved with using Address on a discriminant record; it's not really a GNAT issue.  Even on a non-discriminant record, there are potential problems with the Address aspect because record fields that have implicit initializers are still going to be initialized, unless there's also an Import aspect.  (See AARM 13.3(12.d/3).)  

So on balance, it's probably right in general to use System.Address_To_Access_Conversions instead of Address aspects.

                              -- Adam

  reply	other threads:[~2013-09-26 15:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-26 14:23 Gnat's Handling of Record with Address Clause Eryndlia Mavourneen
2013-09-26 14:48 ` Adam Beneschan
2013-09-26 15:05   ` Eryndlia Mavourneen
2013-09-26 15:21     ` Adam Beneschan [this message]
2013-09-26 15:09 ` Adam Beneschan
2013-09-26 15:46   ` Eryndlia Mavourneen
2013-09-26 20:00 ` Shark8
2013-09-27 12:55   ` Eryndlia Mavourneen
replies disabled

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