Obscure Feature + Obscure Feature + Obscure Feature = Compiler Bug
Posted4 months agoActive4 months ago
antithesis.comTechstory
calmmixed
Debate
40/100
Compiler BugsC++ ProgrammingSoftware Development
Key topics
Compiler Bugs
C++ Programming
Software Development
The article discusses how a combination of obscure C++ features led to a compiler bug, sparking a discussion on the use and understanding of these features among developers.
Snapshot generated from the HN discussion
Discussion Activity
Light discussionFirst comment
3d
Peak period
5
72-78h
Avg / period
3.3
Key moments
- 01Story posted
Sep 20, 2025 at 2:41 PM EDT
4 months ago
Step 01 - 02First comment
Sep 23, 2025 at 10:31 AM EDT
3d after posting
Step 02 - 03Peak activity
5 comments in 72-78h
Hottest window of the conversation
Step 03 - 04Latest activity
Sep 24, 2025 at 3:07 AM EDT
4 months ago
Step 04
Generating AI Summary...
Analyzing up to 500 comments to identify key contributors and discussion patterns
ID: 45316063Type: storyLast synced: 11/20/2025, 4:02:13 PM
Want the full context?
Jump to the original sources
Read the primary article or dive into the live Hacker News thread when you're ready.
In C++, we need some way to give a type internal linkage so that we can have
in one translation unit and the-same-thing-but-with-2-instead-of-1 in another translation unit. Linkage matters to `S::f` and `S::mv`, which would otherwise end up exposed to the world and cause multiply-defined-symbol errors at link time. In C, we can't have member functions or static data members, so (unless I'm missing something) there's no real physical (as opposed to philosophical) reason for a C programmer to care what linkage their types have.If C did support internal-linkage types, I do think it would make sense to support writing simply
instead of C++'s weird hack with the (C++-only) `namespace` keyword.Why did C++ decide to use unnamed namespaces instead of `static struct S { ~~~~ }`? According to Stroustrup's "The Design and Evolution of C++" ("D&E"), the original idea was to separate the two meanings of `static` — unnamed namespaces would take over all the responsibilities related to internal linkage, leaving `static` responsible only for function-local statics and static members. C++98 actually deprecated the use of `static` for internal linkage — but that deprecation was reversed (thank goodness) in C++11, and I imagine most C++ programmers are unaware that such a thing ever happened.
https://stackoverflow.com/questions/4726570/deprecation-of-t...
Sometimes I wish I could just write C# instead.
You used to be able to crash gcc by making the first character of a string literal an 8-bit one.