From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Enumeration representation clause surprise.
Date: Wed, 11 Jun 2008 21:37:06 -0500
Date: 2008-06-11T21:37:06-05:00 [thread overview]
Message-ID: <g2q251$29b$1@jacob-sparre.dk> (raw)
In-Reply-To: g2oqld$qli$1@nntp.ilk.net
"Markus Schoepflin" <nospam@no.spam> wrote in message
news:g2oqld$qli$1@nntp.ilk.net...
> Adam Beneschan wrote:
>> On Jun 11, 6:28 am, Samuel Tardieu <s...@rfc1149.net> wrote:
>>> Markus> This is exactly my point. I would have expected a compile time
>>> error
>>> Markus> for this impossible request.
>>>
>>> Markus> Representation clauses are (amongst other) meant to specify
>>> specific
>>> Markus> binary layouts for interfacing with the external world. Or am I
>>> Markus> mistaken here?
>>>
>>> I can't find anything in RM chapter 13 which either forbids or allows
>>> such a behaviour. I will submit a patch for GNAT which gives a new
>>> warning for this case:
>>>
>>> 11. A1 at 0 range 0 .. 0; -- (*)
>>> |
>>> >>> warning: component representation will be biased
>>
>> This seems odd to me. Having GNAT select a biased component in
>> Christoph's example makes some sense, since a compiler can choose any
>> representation it likes. But in Markus' case, he specifically asked
>> for a certain representation for the enumeration types---should GNAT
>> take it upon itself to change that, and display a warning that doesn't
>> make it clear that it's disrespecting his request to have the
>> enumeration represented a certain way?
>
> Do you suggest to reword the warning? Or give an error instead?
I agree with Adam (whose message I mysteriously didn't receive). Even if the
letter of the RM allows this sort of behavior, it seems wrong from an
expectation basis: an explicitly given representation clause is being
ignored where there is a conflict between two of them. That's never a good
thing. So I think this should be an error - a compiler shouldn't be changing
explicitly given representation items. (I realize that this may not be a
generally held opinion.)
For the record, Janus/Ada gives:
In File D:\Testing\Win\console\rep.ada at line 11
--------------
10: for RECORD_T use record
11: A1 at 0 range 0 .. 0; -- (*)
----------------------------------^
*ERROR* More bits are needed to store all values of the type (6.4.17) [RM
13.5.1(19)]
Continue <Sp> or Abort <^C>?
for this example. But that's not all that interesting, because Janus/Ada
doesn't support biased representations.
Randy.
next prev parent reply other threads:[~2008-06-12 2:37 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-11 11:38 Enumeration representation clause surprise Markus Schoepflin
2008-06-11 12:30 ` christoph.grein
2008-06-11 12:56 ` Markus Schoepflin
2008-06-11 13:08 ` christoph.grein
2008-06-11 13:28 ` Samuel Tardieu
2008-06-11 13:48 ` Markus Schoepflin
2008-06-11 13:56 ` Samuel Tardieu
2008-06-11 14:58 ` Adam Beneschan
2008-06-11 15:23 ` Markus Schoepflin
2008-06-12 2:37 ` Randy Brukardt [this message]
2008-06-12 2:37 ` Randy Brukardt
2008-06-11 15:56 ` Samuel Tardieu
2008-06-11 19:10 ` Adam Beneschan
2008-06-11 19:59 ` Niklas Holsti
2008-06-12 1:16 ` tmoran
2008-06-12 8:27 ` christoph.grein
2008-06-12 8:45 ` Markus Schoepflin
2008-06-12 16:43 ` Mike Silva
2008-06-12 18:41 ` Markus Schöpflin
2008-06-12 20:10 ` Mike Silva
2008-06-12 20:52 ` Simon Wright
2008-06-12 23:36 ` Mike Silva
2008-06-13 5:49 ` Simon Wright
2008-06-13 7:21 ` Keith Thompson
2008-06-13 13:31 ` Mike Silva
2008-06-13 14:45 ` Markus Schoepflin
2008-06-13 17:52 ` Keith Thompson
2008-06-13 9:14 ` Jean-Pierre Rosen
2008-06-12 19:05 ` richtmyer
2008-06-12 21:26 ` Samuel Tardieu
2008-06-12 22:42 ` Adam Beneschan
2008-06-13 7:11 ` Samuel Tardieu
2008-06-13 8:27 ` christoph.grein
2008-06-13 16:21 ` Adam Beneschan
2008-06-15 19:33 ` Robert A Duff
2008-06-16 14:50 ` Adam Beneschan
2008-06-16 19:18 ` Robert A Duff
2008-06-17 6:03 ` christoph.grein
2008-06-17 7:22 ` christoph.grein
2008-06-13 8:24 ` Peter Hermann
2008-06-13 14:47 ` Samuel Tardieu
2008-06-14 11:48 ` John B. Matthews
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox