Re: int a = a

Liste des GroupesRevenir à cl c  
Sujet : Re: int a = a
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.c
Date : 22. Mar 2025, 23:37:48
Autres entêtes
Organisation : None to speak of
Message-ID : <87ldsw8zer.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
User-Agent : Gnus/5.13 (Gnus v5.13)
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
David Brown <david.brown@hesbynett.no> writes:
[...]I believe it would be much simpler and clearer if attempting
to read an uninitialised and unassigned local variable were
undefined behaviour in every case.
>
I probably agree (I haven't given it all that much thought), but
the committee made a specific decision between C90 and C99 to say
that reading an uninitialized automatic object is *not* undefined
behavior.  I'm don't know why they did that (though, all else
being equal, reducing the number of instances of undefined
behavior is a good thing), but reversing that decision for this
one issue is not something they decided to do.
>
Your description of what was done is wrong.  It is still the case in
C99 that trying to access an uninitialized object is undefined
behavior, at least potentially, except for accesses using a type
that either is a character type or has no trap representations (and
all types other than unsigned char may have trap representations,
depending on the implementation).  A statement like
>
    int a = a;
>
may still be given a warning as potential undefined behavior, even
in C99.

I had already mentioned that distinction earlier in the thread.

[...]

The mistake is thinking that UB for uninitialized access was
removed in C99.  It wasn't.  Narrowed, yes;  removed, no.

Acknowledged.

[...]

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

Date Sujet#  Auteur
18 Mar 25 * Bart's Language51bart
18 Mar 25 `* Re: Bart's Language50Waldek Hebisch
18 Mar 25  `* Re: Bart's Language49bart
18 Mar 25   `* Re: Bart's Language48Waldek Hebisch
18 Mar 25    +* Re: Bart's Language40bart
18 Mar 25    i+* Re: Bart's Language32David Brown
18 Mar 25    ii`* int a = a (Was: Bart's Language)31Kenny McCormack
18 Mar 25    ii +* Re: int a = a (Was: Bart's Language)22Janis Papanagnou
18 Mar 25    ii i+- Re: int a = a (Was: Bart's Language)1Kaz Kylheku
19 Mar 25    ii i`* Re: int a = a (Was: Bart's Language)20David Brown
19 Mar 25    ii i +- Re: int a = a (Was: Bart's Language)1Kaz Kylheku
19 Mar 25    ii i +* Re: int a = a11Keith Thompson
20 Mar 25    ii i i+* Re: int a = a9Tim Rentsch
20 Mar 25    ii i ii`* Re: int a = a8Keith Thompson
20 Mar 25    ii i ii `* Re: int a = a7David Brown
20 Mar 25    ii i ii  `* Re: int a = a6Keith Thompson
21 Mar 25    ii i ii   `* Re: int a = a5David Brown
21 Mar 25    ii i ii    `* Re: int a = a4Keith Thompson
21 Mar 25    ii i ii     +- Re: int a = a1David Brown
22 Mar 25    ii i ii     `* Re: int a = a2Tim Rentsch
22 Mar 25    ii i ii      `- Re: int a = a1Keith Thompson
20 Mar 25    ii i i`- Re: int a = a1David Brown
19 Mar 25    ii i +* Re: int a = a (Was: Bart's Language)5Chris M. Thomasson
20 Mar 25    ii i i`* Re: int a = a (Was: Bart's Language)4David Brown
20 Mar 25    ii i i `* Re: int a = a (Was: Bart's Language)3bart
20 Mar 25    ii i i  `* Re: int a = a (Was: Bart's Language)2David Brown
20 Mar 25    ii i i   `- Re: int a = a (Was: Bart's Language)1wij
20 Mar 25    ii i `* Re: int a = a (Was: Bart's Language)2Tim Rentsch
20 Mar 25    ii i  `- Re: int a = a (Was: Bart's Language)1David Brown
18 Mar 25    ii +* Re: int a = a (Was: Bart's Language)3David Brown
18 Mar 25    ii i`* Re: int a = a (Was: Bart's Language)2Janis Papanagnou
19 Mar 25    ii i `- Re: int a = a (Was: Bart's Language)1David Brown
19 Mar 25    ii `* Re: int a = a (Was: Bart's Language)5Tim Rentsch
19 Mar 25    ii  +- Re: int a = a1Keith Thompson
19 Mar 25    ii  +- Re: int a = a (Was: Bart's Language)1David Brown
19 Mar 25    ii  `* Re: int a = a (Was: Bart's Language)2Rosario19
20 Mar 25    ii   `- Re: int a = a (Was: Bart's Language)1Tim Rentsch
20 Mar 25    i`* Re: Bart's Language7Waldek Hebisch
21 Mar 25    i `* Re: Bart's Language6Keith Thompson
22 Mar 25    i  `* Re: Bart's Language5Waldek Hebisch
22 Mar 25    i   `* Re: Bart's Language4James Kuyper
22 Mar 25    i    +* Re: Bart's Language2Waldek Hebisch
23 Mar 25    i    i`- Re: Bart's Language1James Kuyper
23 Mar 25    i    `- By definition... (Was: Bart's Language)1Kenny McCormack
18 Mar 25    `* Re: Bart's Language7bart
20 Mar 25     `* Re: Bart's Language6Waldek Hebisch
21 Mar 25      +* Re: Bart's Language4Kaz Kylheku
21 Mar 25      i`* Re: Bart's Language3bart
21 Mar 25      i `* Re: Bart's Language2Kaz Kylheku
22 Mar 25      i  `- Re: Bart's Language1Tim Rentsch
21 Mar 25      `- Re: Bart's Language1bart

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal