---
title: "Everything in C is undefined behavior"
url: https://daily.dev/posts/everything-in-c-is-undefined-behavior-lf4o5xfht
source_url: https://blog.habets.se/2026/05/Everything-in-C-is-undefined-behavior.html
type: article
source: "Hacker News"
published: 2026-05-20T07:46:11.299Z
updated: 2026-05-20T07:46:35.565Z
tags: ["llm", "c", "c++"]
reading_time: 12
upvotes: 21
comments: 1
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Everything in C is undefined behavior

**[Hacker News](https://daily.dev/sources/hn)** · 12 min read · 21 upvotes · 1 comments

## Summary

A 30-year C/C++ veteran argues that undefined behavior (UB) is so pervasive in C and C++ that no programmer, no matter how expert, can reliably avoid it. The post walks through numerous non-obvious UB examples: misaligned pointer access, casting uint8_t* to int*, passing char to isxdigit(), float-to-int conversion, null pointer semantics, variadic argument type mismatches, and integer promotion surprises. The author contends UB is not just a compiler optimization concern but a fundamental semantic gap — the compiler simply has no way to express the programmer's intent. The post concludes that LLMs are now better than humans at spotting UB, and that writing C/C++ in 2026 without LLM-assisted review is arguably irresponsible, citing findings in OpenBSD's codebase as evidence.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.habets.se/2026/05/Everything-in-C-is-undefined-behavior.html>

## Similar posts on daily.dev

- [C\+\+26: Reducing undefined behaviour](https://daily.dev/posts/c-26-reducing-undefined-behaviour-tbbsne1hb) · Sandor Dargo · 0 upvotes · 0 comments
- [One of the best C\+\+29 features is already available?](https://daily.dev/posts/one-of-the-best-c-29-features-is-already-available--yusxlus0o) · Meeting C\+\+ · 5 upvotes · 0 comments

---

Tags: [#llm](https://daily.dev/tags/llm), [#c](https://daily.dev/tags/c), [#c++](https://daily.dev/tags/c++)

[View this post on daily.dev](https://daily.dev/posts/everything-in-c-is-undefined-behavior-lf4o5xfht)
