From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Unclear error message - please help
Date: Sat, 8 Oct 2005 23:28:12 +0200
Date: 2005-10-08T23:28:11+02:00 [thread overview]
Message-ID: <c8hu6digwtz3$.2fdvq0m7v4r$.dlg@40tude.net> (raw)
In-Reply-To: 43482077.3434FCF3@alfred-hilscher.de
On Sat, 08 Oct 2005 21:39:35 +0200, Alfred Hilscher wrote:
> Robert A Duff schrieb:
>>
>> Don't use Integer all over the place, but instead use
>> different types, to avoid confusion.
>
> Ok, I tried it, but it seems that a "subtype" is also not the solution:
That cannot have any effect. Subtypes do not resolve ambiguity.
> package spec:
> package Pkg is
>
> subtype
> Sixteen_Bits is Integer range 0..65535;
>
> procedure Proc (Host : STRING; RC : out Integer; Identifier : in
> Sixteen_Bits := 0);
>
> procedure Proc (Host : STRING;
> Time_Response : out Integer; RC : out Integer;
> Time_Wait : Integer := 10;
> Identifier : in Sixteen_Bits := 0);
> end Pkg;
Why Time_Wait, Time_Response are Integers? Consider making them Time
(absolute time is always more reliable), or maybe Duration (time span) or
at least
type Milliseconds is new Natural; -- This is not Integer!
Similarly Identifier should be a different type, probably a modular one,
better private.
type Sixteen_Bits is mod 2**16;
It could look like:
type ID is private;
No_ID : constant ID;
procedure Proc
( Host : String;
Count : out Natural;
Identifier : ID := No_ID
);
procedure Proc
( Host : String;
Count : out Natural;
Time_Stamp : out Time;
Time_Out : Duration := 0.01;
Identifier : ID := No_ID
);
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2005-10-08 21:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-17 21:11 Unclear error message - please help Alfred Hilscher
2005-09-17 21:44 ` Gene
2005-09-17 22:02 ` Ludovic Brenta
2005-09-18 2:32 ` Robert A Duff
2005-10-08 19:39 ` Alfred Hilscher
2005-10-08 20:15 ` Björn Persson
2005-10-09 7:34 ` Martin Krischik
2005-10-08 21:28 ` Dmitry A. Kazakov [this message]
2005-10-08 23:58 ` Robert A Duff
2005-10-09 7:29 ` Martin Krischik
2005-10-09 14:24 ` Robert A Duff
2005-10-09 22:02 ` Brian May
2005-10-10 16:49 ` Martin Krischik
2005-10-10 22:20 ` Brian May
2005-10-11 5:48 ` Martin Dowie
2005-10-11 18:03 ` Martin Krischik
[not found] ` <h84lk1tqgofrhgabm8q3sqbb80li6733bh@4ax.com>
2005-10-16 1:10 ` 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