From: "Björn Persson" <spam-away@nowhere.nil>
Subject: Re: Is this definition legal?
Date: Sun, 19 Sep 2004 14:07:09 GMT
Date: 2004-09-19T14:07:09+00:00 [thread overview]
Message-ID: <hog3d.3614$d5.28171@newsb.telia.net> (raw)
In-Reply-To: <87mzznjg5z.fsf@insalien.org>
Ludovic Brenta wrote:
> Whether or not your code is legal, a bug box is a bug. I would be
> interested in a short test case for each of your issues (one for the
> bug box upon declaring a Character_Encoding without an initialiser;
That one is easy:
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Interfaces; use Interfaces;
package Declaration_Bug_Box is
type Known_OS is (NT, OS2, Linux);
This_OS : constant Known_OS := Linux;
type Encoding_ID is
(UTF_8_ID, ASCII_ID, Latin_1_ID);
type Unified_Encoding_Record (Known : Boolean; OS : Known_OS) is record
case Known is
when True =>
Which : Encoding_ID;
when False =>
case OS is
when Linux =>
Name : Unbounded_String;
when NT | OS2 =>
Number : Unsigned_16;
end case;
end case;
end record;
type Character_Encoding (Known : Boolean := False) is
new Unified_Encoding_Record (Known => Known, OS => This_OS);
Trigger_Bug : Character_Encoding;
end Declaration_Bug_Box;
> one for the conversion that alters OS, and one where the conversions
> raises Constraint_Error.
Those are difficult to reproduce. I think they depend on uninitialized
memory and I haven't quite figured out which constant, variable or
parameter it is that doesn't get properly initialized. I'd need a way to
reliably "pre-initialize" memory - that is, to make sure that the right
kind of garbage is present before a variable or constant is created. I'm
working on it.
--
Björn Persson PGP key A88682FD
omb jor ers @sv ge.
r o.b n.p son eri nu
next prev parent reply other threads:[~2004-09-19 14:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-18 23:29 Is this definition legal? Björn Persson
2004-09-18 23:44 ` Ludovic Brenta
2004-09-19 14:07 ` Björn Persson [this message]
2004-09-19 20:21 ` Ludovic Brenta
2004-09-23 21:18 ` Björn Persson
2004-09-19 14:17 ` Björn Persson
2004-09-19 8:42 ` Martin Krischik
2004-09-19 11:25 ` Simon Wright
2004-09-20 7:32 ` Martin Krischik
2004-09-20 13:44 ` Björn Persson
2004-09-20 16:01 ` Martin Krischik
2004-09-20 21:20 ` Randy Brukardt
2004-09-20 17:12 ` Florian Weimer
2004-09-21 7:58 ` Martin Krischik
2004-09-19 11:30 ` Simon Wright
2004-09-19 11:53 ` Martin Dowie
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox