Deutsch   English   Français   Italiano  
<v4vg94$259en$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Terje Mathisen <terje.mathisen@tmsw.no>
Newsgroups: comp.arch
Subject: Re: Concertlina II: Full Circle
Date: Wed, 19 Jun 2024 22:49:40 +0200
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <v4vg94$259en$1@dont-email.me>
References: <mas07jhu9i876gsov2gh8tap17kem5n21p@4ax.com>
 <132536f47d1b160ad3ad0340fc479c1d@www.novabbs.org>
 <v4c17j5eo503i93fb7imjpom5jqs3oivtv@4ax.com>
 <50c85586e1aec0eef53e83cef7cb1d5d@www.novabbs.org>
 <4mb37jdb25571s1q1pjlc3ludaaks7tukr@4ax.com>
 <e4c37jd4l9spbi5b23b525unp9p60ird8q@4ax.com>
 <1401408dead0bbc0b1e2ea7e053c873a@www.novabbs.org>
 <fbn37jpc0banppburc1t6r4hnp3kih23ui@4ax.com>
 <adc60d6b4791061485b8290897609bb3@www.novabbs.org>
 <el047jt94n4eb0l3f829p1jnatncunm5dj@4ax.com>
 <b9790766475e970e390f6c88acba0577@www.novabbs.org>
 <v4uf97$1upbm$1@dont-email.me> <v4v3sf$22gbc$1@dont-email.me>
 <103f75da3109c73e181e04cb5f40e0ae@www.novabbs.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Injection-Date: Wed, 19 Jun 2024 22:49:40 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="5189a7bbc9e672641bc19262bf69249d";
	logging-data="2270679"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19f0+yA2g8zYAlKL92K0Hd2S546jwvFcmZXXgpYEM0UPA=="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
 Firefox/91.0 SeaMonkey/2.53.18.2
Cancel-Lock: sha1:CUMvd7NCiuMZ9ZOaQlhFCjZsLCs=
In-Reply-To: <103f75da3109c73e181e04cb5f40e0ae@www.novabbs.org>
Bytes: 3219

MitchAlsup1 wrote:
> Thomas Koenig wrote:
>=20
>> Terje Mathisen <terje.mathisen@tmsw.no> schrieb:
>>> This is partly due to programming languages that applies lifetimes to=
=20
>>> variables, so that an index register which is defined in the
>>> scaffolding
>>>
>>> of the loop (i.e. for (i =3D 0; i < limit; i++) {}) is invisible as=20
>>> soon as the loop terminates.
>=20
>> This makes things more clear to anybody reading the code (and
>> unambiguous to the compiler).=C2=A0 However, lifetime analysis has
>> also become very good, and if the value is not used afterwards,
>> I expect no difference in practice.
>=20
> When one writes::
>=20
>  =C2=A0=C2=A0=C2=A0 for( uint64_t i =3D 0; i < max; i++ )
>=20
> the lifetime of i is explicit--it terminates with the loop.
>=20
>>> Without such a restriction, there are many times when it would be=20
>>> very natural to inspect the index in order to determine if this was a=
=20
>>> normal
>>>
>>> (counting) exit, or an early exit due to some internal test.
>=20
>> Hmm... do you mean for the programmer, or for the compiler?

This is probably my asm background shining trough:

All asm loops have the counting register available directly after loop=20
exit, until it is reused. When I want to do the same in C I just have to =

define the variable before the loop starts, instead of inside the ().

Terje
--=20
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"