From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Introductory Ada Programming Book
Date: Thu, 5 Jan 2017 00:39:17 +0200
Date: 2017-01-05T00:39:17+02:00 [thread overview]
Message-ID: <ed5bslF2432U1@mid.individual.net> (raw)
In-Reply-To: <5b52afcc-120e-41a5-bab2-7f5c6f647cc2@googlegroups.com>
On 17-01-04 15:44 , raph.amiard@gmail.com wrote:
> I'm in contact with the author so I'll pass any fixes up to him if you don't mind
>
>> exit when (a == 0)
>
>> Switch statements must cover all possible input values --- for unbounded
>> types like integers, a when others is mandatory.
>
> I imagine you refer to the use of "unbounded" when refering to the integer type ?
That term is one nit that could be picked, but more specifically, it is
quite possible to write "case" statements using an integer type without
an "others" clause. Very recently, I had occasion to write code like this:
X : Int_Type := ...
...
case X is
when Int_Type_T'First .. -1 => ...;
when 0 => ...;
when 1 .. Int_Type'Last => ...;
end case;
>> Oddly, variables are not initialised by default
>> (Personal opinion: default initialization is a huge mistake)
>
> Ok but, besides the "oddly" qualifier, his statement is correct, right ?
Except for variables of an access type, or (but perhaps this is not "by
default" in his view) of a record type where the components are given
initial default values.
Requiring default initialisation of all variables, even unused ones,
would have a large cost in execution time of any subprogram that uses a
local array variable as a buffer for some data. In a
resource-constrained real-time application that could be nasty. (For
such code, I have once or twice argued with PA/QA people who see a
coding rule that says "all variables must be initilised before use" and
who think that "X := value" is a "use" of X :-) ).
--
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
. @ .
next prev parent reply other threads:[~2017-01-04 22:39 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-31 13:18 Introductory Ada Programming Book Andrew Shvets
2016-12-31 14:26 ` Lucretia
2016-12-31 15:10 ` Dmitry A. Kazakov
2016-12-31 17:14 ` Andrew Shvets
2016-12-31 14:28 ` Lucretia
2016-12-31 14:34 ` Lucretia
2016-12-31 17:22 ` Andrew Shvets
2016-12-31 17:59 ` Gour
2017-01-02 15:56 ` Andrew Shvets
2017-01-02 16:32 ` Gour
2017-01-03 15:31 ` Patrick Noffke
2017-01-03 22:18 ` Andrew Shvets
2017-01-04 1:14 ` Paul Rubin
2017-01-04 3:07 ` Andrew Shvets
2017-01-04 6:46 ` J-P. Rosen
2017-01-04 9:25 ` raph.amiard
2017-01-04 12:40 ` J-P. Rosen
2017-01-04 12:49 ` Dmitry A. Kazakov
2017-01-04 13:45 ` raph.amiard
2017-01-04 14:14 ` Dmitry A. Kazakov
2017-01-04 15:15 ` Simon Wright
2017-01-10 10:02 ` raph.amiard
2017-01-04 15:18 ` Shark8
2017-01-04 21:47 ` Randy Brukardt
2017-01-05 3:04 ` Shark8
2017-01-05 7:51 ` G.B.
2017-01-04 13:44 ` raph.amiard
2017-01-04 22:08 ` Jeffrey R. Carter
2017-01-04 22:39 ` Niklas Holsti [this message]
2017-01-05 0:38 ` G.B.
2017-01-05 23:52 ` Randy Brukardt
2017-01-05 6:36 ` J-P. Rosen
2017-01-05 8:38 ` Simon Wright
2017-01-10 10:13 ` raph.amiard
2017-01-09 22:01 ` Robert Eachus
2017-01-04 23:42 ` Andrew Shvets
2017-01-05 0:47 ` G.B.
2017-01-05 19:01 ` Jacob Sparre Andersen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox