Re: C23 thoughts and opinions

Liste des GroupesRevenir à l c 
Sujet : Re: C23 thoughts and opinions
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.c
Date : 05. Jun 2024, 08:14:37
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v3p38t$s5n4$2@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
User-Agent : Pan/0.158 (Avdiivka; )
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.

Date Sujet#  Auteur
4 Jun 24 * Re: C23 thoughts and opinions11Kaz Kylheku
4 Jun 24 +- Re: C23 thoughts and opinions1Michael S
4 Jun 24 +- Re: C23 thoughts and opinions1David Brown
4 Jun 24 `* Re: C23 thoughts and opinions8BGB
4 Jun 24  +* Re: C23 thoughts and opinions2BGB-Alt
5 Jun 24  i`- Re: C23 thoughts and opinions1Lawrence D'Oliveiro
5 Jun 24  `* Re: C23 thoughts and opinions5Lawrence D'Oliveiro
5 Jun 24   `* Re: C23 thoughts and opinions4BGB
7 Jun 24    `* Re: C23 thoughts and opinions3Lawrence D'Oliveiro
7 Jun 24     `* Re: C23 thoughts and opinions2BGB
14 Jun 24      `- Re: C23 thoughts and opinions1Lawrence D'Oliveiro

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal