Re: Ichbiah 2022 compiler mode

Liste des GroupesRevenir à cl ada 
Sujet : Re: Ichbiah 2022 compiler mode
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.ada
Date : 21. Dec 2024, 22:26:06
Autres entêtes
Organisation : None to speak of
Message-ID : <87frmgwwwh.fsf@nosuchdomain.example.com>
References : 1 2 3 4
User-Agent : Gnus/5.13 (Gnus v5.13)
"Randy Brukardt" <randy@rrsoftware.com> writes:
[...]
A lot of "variables" in code actually are only written once. In Ada, those
are better modeled as constants. A constant tells the reader that the value
doesn't change during the life of the object, which is easier for analysis
(both human and machine).
[...]

Agreed.  But my understanding is that compilers typically do this kind
of analysis anyway, at least when optimization is enabled.  For example,
if I write:

    N : Integer := 42;

and later refer to the value of N, if the compiler is able to prove to
itself that N is never modified after its initialization, it can replace
a reference to N with the constant 42 (and possibly fold it into other
constant expressions).

Using "constant" for something that isn't going to be modified is good
practice, but I'd say it's for the benefit of the human reader.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */

Date Sujet#  Auteur
5 Sep 24 * Ichbiah 2022 compiler mode44Kevin Chadwick
5 Sep 24 +* Re: Ichbiah 2022 compiler mode6Jeffrey R.Carter
5 Sep 24 i+* Re: Ichbiah 2022 compiler mode2Bill Findlay
5 Sep 24 ii`- Re: Ichbiah 2022 compiler mode1Jeffrey R.Carter
5 Sep 24 i+- Re: Ichbiah 2022 compiler mode1Kevin Chadwick
5 Sep 24 i`* Re: Ichbiah 2022 compiler mode2Kevin Chadwick
5 Sep 24 i `- Re: Ichbiah 2022 compiler mode1Jeffrey R.Carter
6 Sep 24 +* Re: Ichbiah 2022 compiler mode35Randy Brukardt
6 Sep 24 i+* Re: Ichbiah 2022 compiler mode5Lawrence D'Oliveiro
12 Sep 24 ii`* Re: Ichbiah 2022 compiler mode4Randy Brukardt
12 Sep 24 ii `* Re: Ichbiah 2022 compiler mode3Lawrence D'Oliveiro
14 Sep 24 ii  `* Re: Ichbiah 2022 compiler mode2Randy Brukardt
14 Sep 24 ii   `- Re: Ichbiah 2022 compiler mode1Lawrence D'Oliveiro
6 Sep 24 i+* Re: Ichbiah 2022 compiler mode15Simon Wright
7 Sep 24 ii`* Re: Ichbiah 2022 compiler mode14Niklas Holsti
7 Sep 24 ii +- Re: Ichbiah 2022 compiler mode1Nioclás Pól Caileán de Ghloucester
12 Sep 24 ii `* Re: Ichbiah 2022 compiler mode12Randy Brukardt
12 Sep 24 ii  +* Re: Ichbiah 2022 compiler mode5Niklas Holsti
12 Sep 24 ii  i+- Re: Ichbiah 2022 compiler mode1Dmitry A. Kazakov
12 Sep 24 ii  i`* Re: Ichbiah 2022 compiler mode3Kevin Chadwick
12 Sep 24 ii  i +- Re: Ichbiah 2022 compiler mode1Niklas Holsti
13 Sep 24 ii  i `- Re: Ichbiah 2022 compiler mode1Nioclás Pól Caileán de Ghloucester
12 Sep 24 ii  `* Re: Ichbiah 2022 compiler mode6J-P. Rosen
12 Sep 24 ii   `* Re: Ichbiah 2022 compiler mode5Niklas Holsti
14 Sep 24 ii    `* Re: Ichbiah 2022 compiler mode4Randy Brukardt
14 Sep 24 ii     +- Re: Ichbiah 2022 compiler mode1Dmitry A. Kazakov
14 Sep 24 ii     +- Re: Ichbiah 2022 compiler mode1Lawrence D'Oliveiro
14 Sep 24 ii     `- Re: Ichbiah 2022 compiler mode1Niklas Holsti
21 Dec 24 i+* Re: Ichbiah 2022 compiler mode12Lioneldraghi
21 Dec 24 ii`* Re: Ichbiah 2022 compiler mode11Randy Brukardt
21 Dec 24 ii +* Re: Ichbiah 2022 compiler mode2Jeffrey R.Carter
24 Dec 24 ii i`- Re: Ichbiah 2022 compiler mode1Randy Brukardt
21 Dec 24 ii +* Re: Ichbiah 2022 compiler mode6G.B.
21 Dec 24 ii i+- Re: Ichbiah 2022 compiler mode1Chris Townley
22 Dec 24 ii i+* Re: Ichbiah 2022 compiler mode3Simon Wright
22 Dec 24 ii ii`* Re: Ichbiah 2022 compiler mode2G.B.
23 Dec 24 ii ii `- Re: Ichbiah 2022 compiler mode1Simon Wright
24 Dec 24 ii i`- Re: Ichbiah 2022 compiler mode1Randy Brukardt
21 Dec 24 ii `* Re: Ichbiah 2022 compiler mode2Keith Thompson
22 Dec 24 ii  `- Re: Ichbiah 2022 compiler mode1Pascal Obry
21 Dec 24 i`* Re: Ichbiah 2022 compiler mode2Lioneldraghi
21 Dec 24 i `- Re: Ichbiah 2022 compiler mode1Randy Brukardt
6 Sep 24 `* Re: Ichbiah 2022 compiler mode2Jeffrey R.Carter
6 Sep 24  `- Re: Ichbiah 2022 compiler mode1Nioclás Pól Caileán de Ghloucester

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal