Re: Can you please verify that the analysis of these C functions is correct?

Liste des GroupesRevenir à cl c  
Sujet : Re: Can you please verify that the analysis of these C functions is correct?
De : david.brown (at) *nospam* hesbynett.no (David Brown)
Groupes : comp.lang.c comp.lang.c++
Date : 23. Jun 2024, 14:43:17
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v59595$ban8$3@dont-email.me>
References : 1 2 3 4 5 6 7 8 9
User-Agent : Mozilla Thunderbird
On 22/06/2024 21:17, Chris M. Thomasson wrote:
On 6/22/2024 10:58 AM, Bonita Montero wrote:
Am 22.06.2024 um 18:36 schrieb olcott:
>
It seems pretty stupid to allow gaps in the semantics of C++ programs. Simply specify that the order of evaluation is left to right unless:
(a) Otherwise specified such as operator precedence rules.
(b) Derives the same result as left to right ordering.
>
Most UB is there to allow optimizations, also in this case.
I've got no problem with that.
>
>
 Humm. Sounds reasonable. UB is there to be defined by a non-conforming compiler? ;^)
No, UB is there so that /conforming/ compilers don't have to implement any specific behaviour for it, and can optimise assuming that either it doesn't happen, or that you don't care about the results if it does happen.
It is also useful for static analysis and debugging and tools like sanitizers - since UB is typically the result of something you don't want to happen in your code, like overflows, debugging tools can add extra code to tell you of such events.  If overflow behaviour had been defined, it would be normal and expected behaviour, and debugging tools can't freely change that.
Compilers - conforming or not - are always free to pick a definition for something that the standard says is undefined behaviour (either explicitly, or by simply omitting a definition for the behaviour).  If they document this definition, you can view it as an extension and rely on its use - if they don't document it, you rely on it at your own risk.

Date Sujet#  Auteur
17 Jun 24 * Can you please verify that the analysis of these C functions is correct?25olcott
17 Jun 24 +* Re: Can you please verify that the analysis of these C functions is correct?23Bonita Montero
17 Jun 24 i+- Re: Can you please verify that the analysis of these C functions is correct?1olcott
19 Jun 24 i+- Re: Can you please verify that the analysis of these C functions is correct?1olcott
21 Jun 24 i`* Re: Can you please verify that the analysis of these C functions is correct?20olcott
22 Jun 24 i +* Re: Can you please verify that the analysis of these C functions is correct?18Richard Harnden
22 Jun 24 i i`* Re: Can you please verify that the analysis of these C functions is correct?17olcott
22 Jun 24 i i `* Re: Can you please verify that the analysis of these C functions is correct?16Richard Damon
22 Jun 24 i i  `* Re: Can you please verify that the analysis of these C functions is correct?15olcott
22 Jun 24 i i   +* Re: Can you please verify that the analysis of these C functions is correct?6Richard Damon
22 Jun 24 i i   i`* Re: Can you please verify that the analysis of these C functions is correct?5Bonita Montero
22 Jun 24 i i   i `* Re: Can you please verify that the analysis of these C functions is correct?4Richard Damon
23 Jun 24 i i   i  `* Re: Can you please verify that the analysis of these C functions is correct?3Bonita Montero
23 Jun 24 i i   i   +- Re: Can you please verify that the analysis of these C functions is correct?1Richard Damon
23 Jun 24 i i   i   `- Re: Can you please verify that the analysis of these C functions is correct?1David Brown
22 Jun 24 i i   +* Re: Can you please verify that the analysis of these C functions is correct?7Bonita Montero
22 Jun 24 i i   i`* Re: Can you please verify that the analysis of these C functions is correct?6Chris M. Thomasson
22 Jun 24 i i   i +* Re: Can you please verify that the analysis of these C functions is correct?3Richard Damon
22 Jun 24 i i   i i+- Re: Can you please verify that the analysis of these C functions is correct?1Chris M. Thomasson
22 Jun 24 i i   i i`- Re: Can you please verify that the analysis of these C functions is correct?1Chris M. Thomasson
22 Jun 24 i i   i +- Re: Can you please verify that the analysis of these C functions is correct?1James Kuyper
23 Jun 24 i i   i `- Re: Can you please verify that the analysis of these C functions is correct?1David Brown
23 Jun 24 i i   `- Re: Can you please verify that the analysis of these C functions is correct?1David Brown
26 Jun 24 i `- Re: Can you please verify that the analysis of these C functions is correct?1Bonita Montero
23 Jun 24 `- Re: Can you please verify that the analysis of these C functions is correct?1olcott

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal