Groups | Search | Server Info | Login | Register


Groups > comp.compilers > #3676

Undefined behaviour in C23

Path csiph.com!weretis.net!feeder9.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end
From Martin Ward <mwardgkc@gmail.com>
Newsgroups comp.compilers
Subject Undefined behaviour in C23
Date Wed, 20 Aug 2025 14:06:45 +0100
Organization Compilers Central
Sender johnl%iecc.com
Approved comp.compilers@iecc.com
Message-ID <25-08-002@comp.compilers> (permalink)
MIME-Version 1.0
Content-Type text/plain; charset="UTF-8"
Injection-Info gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="40152"; mail-complaints-to="abuse@iecc.com"
Keywords C, standards, comment
Posted-Date 20 Aug 2025 14:15:45 EDT
X-submission-address compilers@iecc.com
X-moderator-address compilers-request@iecc.com
X-FAQ-and-archives http://compilers.iecc.com
Xref csiph.com comp.compilers:3676

Show key headers only | View raw


In the SEI CERT C Soding Standards we read:

"According to the C Standard, Annex J, J.2 [ISO/IEC 9899:2024],
the behavior of a program is undefined in the circumstances outlined
in the following table."

The table has 221 numbered cases and can be found here:

<https://wiki.sei.cmu.edu/confluence/display/c/CC.%2BUndefined%2BBehavior>

According to the C Standard Committee (paraphrasing) "You may eat
from any tree in the garden of coding, except for any of the 221
trees of undefined behaviour. If you eat from any of the 221 trees
of undefined behaviour your program may die, either immediately or at
some unspecified time in the future, or may do absolutely anything at
any future time. You must study the Book of the Knowledge of Defined
and Undefined (the 758 page C23 standard document) to learn exactly
how to recognise each of the 221 trees of undefined behaviour.
Please pay the cashier $250.00 to purchase a copy of the Book
of the Knowledge of Defined and Undefined".


\--
Martin

Dr Martin Ward | Email: [martin@gkc.org.uk](mailto:martin@gkc.org.uk) | <http://www.gkc.org.uk>
G.K.Chesterton site: <http://www.gkc.org.uk/gkc> | Erdos number: 4
[When a language is 50 years old and there is a mountain of legacy code that
they really don't want to break, it accumulates a lot of cruft. If we were
starting now we'd get something more like Go.

On the other hand, there's the python approach in which they deprecate and
remove little used and crufty features, but old python code doesn't work any
more unless you go back and update it every year or two. -John]

Back to comp.compilers | Previous | NextNext in thread | Find similar


Thread

Undefined behaviour in C23 Martin Ward <mwardgkc@gmail.com> - 2025-08-20 14:06 +0100
  Re: Undefined behaviour in C23 Kaz Kylheku <643-408-1753@kylheku.com> - 2025-08-20 18:33 +0000
    Re: Undefined behaviour in C23 David Brown <david.brown@hesbynett.no> - 2025-08-21 15:02 +0200
      Re: Undefined behaviour in C23 Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-08-21 12:53 -0700
        Re: Undefined behaviour in C23 David Brown <david.brown@hesbynett.no> - 2025-08-22 17:58 +0200
          Re: Undefined behaviour in C23 anton@mips.complang.tuwien.ac.at - 2025-08-22 17:16 +0000
          Re: Undefined behaviour in C23 Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-08-22 15:11 -0700
            Re: Undefined behaviour in C23 David Brown <david.brown@hesbynett.no> - 2025-08-23 16:55 +0200
              Re: Undefined behaviour in C23 Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-08-23 15:58 -0700
              Re: Undefined behaviour in C23 James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-08-25 22:13 -0400
                Re: Undefined behaviour in C23 James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-08-26 13:41 -0400
                Re: Undefined behaviour in C23 Michael S <already5chosen@yahoo.com.dmarc.email> - 2025-08-26 22:28 +0300
                Re: Undefined behaviour in C23 James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-08-26 16:53 -0400
  Re: Undefined behaviour in C23 anton@mips.complang.tuwien.ac.at - 2025-08-21 05:44 +0000
    Re: Undefined behaviour in C23 David Brown <david.brown@hesbynett.no> - 2025-08-22 18:42 +0200
      Re: Undefined behaviour in C23 anton@mips.complang.tuwien.ac.at - 2025-09-06 17:15 +0000

csiph-web