Deutsch   English   Français   Italiano  
<v3p38t$s5n4$2@dont-email.me>

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

Path: ...!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Lawrence D'Oliveiro <ldo@nz.invalid>
Newsgroups: comp.lang.c
Subject: Re: C23 thoughts and opinions
Date: Wed, 5 Jun 2024 07:14:37 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <v3p38t$s5n4$2@dont-email.me>
References: <v2l828$18v7f$1@dont-email.me> <v2unfe$3alds$1@dont-email.me>
	<v2v637$3cunk$1@raubtier-asyl.eternal-september.org>
	<v3dmq6$2edto$1@dont-email.me> <hOu6O.6223$xPJ1.1866@fx09.iad>
	<20240602110213.00003b25@yahoo.com> <v3hn2j$3bdjn$1@dont-email.me>
	<20240602162914.0000648c@yahoo.com> <v3ii22$3g9ch$1@dont-email.me>
	<20240603120043.00003511@yahoo.com> <v3kra8$3vgef$1@dont-email.me>
	<Kvm7O.5231$Ktt5.2929@fx40.iad> <20240603225856.0000679d@yahoo.com>
	<3uq7O.9130$nd%8.1870@fx45.iad> <20240603221239.245@kylheku.com>
	<v3nk1q$h9jb$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 05 Jun 2024 09:14:38 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="4516e25990465832a6742c15b1bf965a";
	logging-data="923364"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+HGPet2vIe1y4TFZ38qmsL"
User-Agent: Pan/0.158 (Avdiivka; )
Cancel-Lock: sha1:NMHPofpQxespw3wcNu9sVQSfSl4=
Bytes: 2456

On Tue, 4 Jun 2024 12:48:31 -0500, BGB wrote:

> Though, I do have some questionable experimental features, like a
> compiler option to cause arrays and pointers to be bounds-checked, which
> is sometimes useful in debugging (but in some cases can add bugs of its
> own; also makes the binaries bigger and negatively effects performance,
> ...).

I remember some research being done into this, back in the days of Pascal.

Remember that, in Pascal (and Ada), subranges exist as types in their own 
right, not just as bounds of arrays. And this allows the compiler to 
optimize array-bounds checks, and sometimes get rid of them altogether. 
E.g.

    type
        boundstype = 1 .. 10;
    var
        myarr : array [boundstype] of elttype;
        index : boundstype;

With these definitions, an expression like

    myarr[index]

doesn’t require any bounds-checking. Of course, assignments to index may 
require bounds-checking, depending on the types of values involved.