Writing a (valid) C program without main()
birdculture
20 points
7 comments
July 25, 2026
Related Discussions
Found 5 related stories in 54.2ms across 5,917 title embeddings via pgvector HNSW
- Using GCC's Nested Functions with Wide Pointers and No Trampolines II uecker · 92 pts · August 15, 2026 · 47% similar
- C*: Unifying Programming and Verification in C (2025) rramadass · 76 pts · September 08, 2026 · 45% similar
- Getting silly with C, part and((int*)-8)[3] surprisetalk · 26 pts · August 21, 2026 · 44% similar
- The Ten Commandments for C Programmers from Henry Spencer (Unix/Plan 9 – 1987) pjmlp · 11 pts · July 28, 2026 · 44% similar
- Indirect Calling of Nested Functions on GCC Without Executable Stack uecker · 72 pts · August 29, 2026 · 44% similar
Discussion Highlights (4 comments)
eska
Note that this is not a “valid” C program according to the standard. The standard allows for freestanding and hosted environments. Freestanding allows for the entry point to be called something else than main, but there are other requirements. See section 4 and 5 of a draft if interested.
asveikau
I think the definition of "valid" may differ. Is this a standard conforming C program? No. Did you use implementation details of your platform to create a program that loads and runs correctly? Sure. Most interesting C programs violate the standard in some way though.
pishpash
This isn't making a C program. It's using C tools and assembly tools to make an executable.
pjmlp
> C is the closest you can get to the operating system without writing assembly. Nope, plenty of languages have been offering the same features since JOVIAL in 1958. That is an urban myth spread by folks that never learnt another systems programming language, or computing history.