comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: for Object_Size use 0
Date: 14 Apr 2005 10:48:15 -0400
Date: 2005-04-14T10:48:15-04:00	[thread overview]
Message-ID: <wccpswx4dow.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: mailman.31.1113456844.24457.comp.lang.ada@ada-france.org

Christoph Grein <Christoph.Grein@eurocopter.com> writes:

> Robert A Duff wrote:
> 
> > "Robert C. Leif" <rleif@rleif.com> writes:
> >
> >
> >>      I specifically need to know if it is possible to create a zero
> >> sized
> >> type in Ada 95 or the updated standard, which is to be released in
> >> the near
> >> future.
> >
> > For a discrete type, Size can be zero.  So in your example:
> >
> >    type Empty_Type is (Empty);
> >
> > Empty_Type'Size must be zero (if there is no Size clause).
> > This follows from RM-13.3(55).  The same is true of
> > "subtype S is Integer range 0..0;" -- S'Size = 0 by default.
> > See also para 55.b in the AARM.
> >
> But this is only "Implementation Advice". Consequently RM-13.3(55) uses
> the word "should".

Yes, but C.2(2) turns that Advice into hard requirements.  So any
compiler that claims to support Annex C (which GNAT does) must obey that
advice.

So what I said is not entirely correct, since an implementation need not
support Annex C.  But in practise, what I said is true, since pretty
much all Ada implementations (claim to) support this Annex.

Anyway, even for Implementation Advice that is not covered by C.2,
implementations really ought to obey, unless they have good reason not
to.  So it's often legitimate to complain to your compiler vendor if
they don't obey Advice.  In retrospect, I think perhaps we should not
have called it "Implementation Advice".  Perhaps "Informal Rules" or
"Untestable Requirements" would be better.  Most of these really ought
to be language rules; it's just that there's no way to formalize them,
and therefore no way to test them in an ACATS-style test suite.

> But you're the language lawyer...

;-)  ...which is why I know about C.2.

- Bob



  reply	other threads:[~2005-04-14 14:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-14  5:20 for Object_Size use 0 Christoph Grein
2005-04-14 14:48 ` Robert A Duff [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-04-13 12:02 Robert C. Leif
2005-04-13  1:52 Robert C. Leif
2005-04-13  7:58 ` Martin Dowie
2005-04-13 15:51 ` Robert A Duff
replies disabled

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