Oh, the thrilling quest to reduce undefined behavior in C! 🥱 Because who doesn't love spending time solving problems that shouldn't exist in the first place? 🙄 Let's make C "safer" by holding a #conference featuring MRI scanner enthusiasts—because nothing screams "kernel expertise" quite like biomedical engineering! 🧠🔧
https://lwn.net/Articles/1095811/ #undefinedBehavior #CProgramming #biomedicalEngineering #kernelSafety #HackerNews #ngated
#undefinedbehavior — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #undefinedbehavior, aggregated by home.social.
-
-
Reducing undefined behavior in the C language
https://lwn.net/Articles/1095811/
Comments: https://news.ycombinator.com/item?id=50015074
#HackerNews #C #language #UndefinedBehavior #SoftwareDevelopment #Programming #BestPractices #CodeQuality
-
Ah yes, the grand art of type punning—a sport where brave souls wrestle with undefined behavior and pretend they're winning. 🙄 Our hero Steve discovers the age-old truth: just because it works at O0 doesn't mean it won't explode spectacularly at O2. 🎉 But hey, at least there's a personal workflow blog to document the chaos!
https://blog.pwkf.org/2026/09/21/correct-type-punning-in-c.html #typepunning #undefinedbehavior #codinghumor #programmingblog #developerlife #HackerNews #ngated -
“C++26: Reducing Undefined Behaviour”, Sandor Dargo (https://www.sandordargo.com/blog/2026/07/29/cpp26-reduces-undefined-behaviour).
Via Lobsters: https://lobste.rs/s/xinbkz/c_26_reducing_undefined_behaviour
#UndefinedBehavior #CPP #CPlusPlus #Programming #PLDI #Compilers
-
From the Comp-Cert release notes - sanity in C programming. Someone call ISO and complain.
"Constant propagation: optimize "known integer or undefined" results. For example, &x == &x, which is either 1 or undefined, is now replaced by 1"
-
😥:
“Everything In C Is Undefined Behavior”, Thomas Habets (https://blog.habets.se/2026/05/Everything-in-C-is-undefined-behavior.html).
Via HN: https://news.ycombinator.com/item?id=48203698
On Lobsters: https://lobste.rs/s/dtcfd6/everything_c_is_undefined_behavior
#Programming #C #CPP #CPlusPlus #UB #UndefinedBehavior #Standards
-
Oh, look! Another pretentious C programmer bemoaning the inevitability of undefined behavior like it's some sort of philosophical revelation. 🙄 We're all just helpless marionettes in the grand theater of programming, swirling in a vortex of #pointers and segfaults! 🤹♂️
https://blog.habets.se/2026/05/Everything-in-C-is-undefined-behavior.html #pretentiousCprogrammer #undefinedBehavior #programmingHumor #segfaults #HackerNews #ngated -
Today is the perfect day to listen to some #undefinedbehavior #psytrance #music
ht @buherator
https://soundcloud.com/burninnoise/undefined-behavior-vs-altruism-perception-box
-
The production bug that made me care about undefined behavior
https://gaultier.github.io/blog/the_production_bug_that_made_me_care_about_undefined_behavior.html
#HackerNews #productionbug #undefinedbehavior #programmingcare #techstories #softwaredevelopment
-
"Behold, the epic quest for 'Dependable C' - because nothing screams #reliability like undefined behavior and broken VLAs 🤦♂️! In a dazzling display of verbosity, they ironically try to fix C with more convoluted #C23 and mythical #C2Y, because adding chaos is the path to safety, right? 🤔🔧"
https://dependablec.org/ #DependableC #UndefinedBehavior #SoftwareDevelopment #HackerNews #ngated -
Nice 👌🏽👇🏽:
“Undefined Behavior In C And C++” [2024], Russell Wallace (https://russellw.github.io/undefined-behavior).
Via HN: https://news.ycombinator.com/item?id=44841891
#UndefinedBehavior #Programming #C #CPP #Compilers #Optimization #Standards #UB
-
🚀😂 Oh, look! Another grandiose plan to sprinkle some #Rust magic on #C, only to be abandoned faster than you can say "undefined behavior". But hey, at least the proposal taught us that gluing #safety onto C is like trying to attach wings to a car and expecting it to fly 🚗✈️.
https://sibellavia.lol/posts/2025/09/safe-c-proposal-is-not-being-continued/ #Crossover #RustMagic #UndefinedBehavior #CodingHumor #HackerNews #ngated -
@wyatt I've seen others interpret it as rav1d offering a $20,000 bug bounty for dav1d, the C decoder. If you find exploitable undefined behavior that the dav1d devs have to spend 5% of CPU time to prevent, you win.
#rav1d #dav1d #av1 #BugBounty #UndefinedBehavior #riir #rustlang
-
“[…] But they also made some mistakes… which is not too surprising when you are doing this kind of work. And I would like rust ideally not to repeat these mistakes. I think we can make our own new and fun unique mistakes”
Ralf Jung on the MiniRust language specification proposal
#rustlang #formalLanguage #undefinedBehavior
https://www.youtube.com/watch?v=UKCUZtr378s&t=5h13m00s -
Ah yes, because what could be more exhilarating than "fun" with undefined behavior and C libraries? 🤔 Just when you thought C couldn't get any more "entertaining," here comes a blog post to remind you that the real circus is in the code you *didn't* know was breaking things. 🎪🔧
https://keithp.com/blogs/sanitizer-fun/ #CProgramming #UndefinedBehavior #FunWithCode #CodeCircus #TechHumor #HackerNews #ngated -
I put an overview of my preliminary (!) analysis of undefined behavior in the core language and the status in C2Y into the ISO WG14 document log.
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3529.pdf
#undefinedbehavior #clanguage -
Ah, yes, let's all gather 'round the campfire to hear the age-old tale of #C and #C++, where speed demons rule and correctness is just a bedtime story 🙄🚀. Apparently, back in 1989, the wizards of #programming thought "undefined behavior" sounded like a great idea—because who doesn't love a little #chaos in their code? 😜🤯 #YOLOCoding #UndefinedIsTheNewDefined
https://research.swtch.com/ub #UndefinedBehavior #Coding #HackerNews #ngated -
A Guide to Undefined Behavior in C and C++ (2010)
https://blog.regehr.org/archives/213
#HackerNews #UndefinedBehavior #C #C++ #Guide #Programming #2010
-
“C++ Standards Contributor Expelled For 'The Undefined Behavior Question'”, Slashdot (https://m.slashdot.org/submission/17330375).
On HN: https://news.ycombinator.com/item?id=42226250
On /r/cpp: https://old.reddit.com/r/cpp/comments/1gyiwwc/c_standards_contributor_expelled_for_the/
#CPP #CPlusPlus #Standards #ChatGPT #UndefinedBehavior #WTF #AntiSemitism
-
Neither #C nor a modern #CPU give timing guarantees, so this is weird:
“Clang Vs Clang”, Daniel Bernstein (https://blog.cr.yp.to/20240803-clang.html).
On HN: https://news.ycombinator.com/item?id=41146860
On Lobsters: https://lobste.rs/s/kumzku/clang_vs_clang
#Cryptography #Optimization #GCC #Clang #Compilers #UndefinedBehavior
-
New on the blog: A brief detour, as some of the support code I wrote for last week's Amiga project went *terribly* wrong. A tale of berzerk optimizing compilers and undefined behavior, and a reconstruction of its antics.
https://bumbershootsoft.wordpress.com/2024/06/29/amiga-500-interlude-nasal-demons/
-
“Why Do We Need A [sic] Undefined Behavior Annex For The C++ Standard?”, Intel (https://community.intel.com/t5/Blogs/Tech-Innovation/Tools/Why-do-we-need-a-Undefined-Behavior-Annex-for-the-C-standard/post/1574397).
“P1705R1: Enumerating Core Undefined Behavior” (http://wg21.link/P1705).
-
When it comes to "undefined behavior" (UB) in C++ programs, I sometimes wonder if *part of the problem* is that the C++ standard is relatively "over specified".
(For the record, I'm OK with this aspect of the C++ spec.)
E.g., Java has only signed integers and the integers can overflow/underflow just like signed integers in C++, but we don't see reams of UB commentary about that issue in Java.
-
And also this three-part series:
“What Every C Programmer Should Know About Undefined Behavior” [2011], Chris Lattner (http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html, http://blog.llvm.org/2011/05/what-every-c-programmer-should-know_14.html, and http://blog.llvm.org/2011/05/what-every-c-programmer-should-know_21.html).
-
Time to reprise this three-part series:
“A Guide To Undefined Behavior In C And C++” [2010], John Regehr (https://blog.regehr.org/archives/213, https://blog.regehr.org/archives/226, and https://blog.regehr.org/archives/232).
-
😅 last line:
“C And C++ Prioritize Performance Over Correctness”, Russ Cox (https://research.swtch.com/ub).
On HN: https://news.ycombinator.com/item?id=37178009
On Lobsters: https://lobste.rs/s/qvolpv/c_c_prioritize_performance_over
On /r/C_Programming: https://www.reddit.com/r/C_Programming/comments/15uvr9j/c_and_c_prioritize_performance_over_correctness/
-
int main(void) {
int i = 0;
return i;
}This code has undefined behavior (at least in C99 and before) because there is no sequence point between the initialization of
i(which writes to the object) and the return expression (which reads from the object).
Change my mind. Please. 😟
#C #C99 #UndefinedBehavior -
@hywan gcc is not wrong though. You need to check upfront with a decent bounds check that what you will do is OK in C, rather than do it, then see if something undefined happened.
Unfortunately there weren't good tools in the C or C++ stdlib to do checking for a long time.
For C++: https://learn.microsoft.com/en-us/cpp/safeint/safeint-library
C from c23 has builtins to do this, and each common compiler does too:
https://stackoverflow.com/questions/199333/how-do-i-detect-unsigned-integer-overflow -
“For all the talk C programmers love to make about how ‘close to the metal’ they are, they never really were. — @thephd https://thephd.dev/c-undefined-behavior-and-the-sledgehammer-guideline #cProgramming #cLanguage #cplusplus #cpplang #programming #systemsProgramming #abstractMachine #undefinedBehavior #undefinedBehaviour
-
And if you have a problem with #undefinedbehavior in C++, then you do not listen to @copperspice_cpp and @lefticus.
-
My problem with undefined behavior, isn't that there are things in C/C++ you can't do. Every programming language has things you can't do.
My problem is that the compiler and runtime isn't required to tell you that you're not allowed to do it.
Indeed, some forms of UB don't appear to be suspicious at all. A programmer would be forgiven to think they are allowed by the language.
And then when the program breaks we call that human error, but it is, in reality, bad design, to borrow an idea from Don Norman.
It's like a push-only door that's labelled "pull"!
#normanDoors #programming #cprogramming #cpplang #cplusplus #design #undefinedbehavior #undefinedbehaviour
-
Devilish :blobcateyes:
I thought "#compiler is allowed to do anything under #UndefinedBehavior" was a bit of a meme, but it's shocking to see it in practice.
Do is a static (local to this file) function pointer and it's only ever set in NeverCalled. So even though NeverCalled never actually gets executed, the compiler performs the set at compile time as an optimization and this is allowed because there is undefined behavior.