Skip to content
HomeVideosBooksBlogs
AllTop postsTopics
Podcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    J

    Jroweboy

    jroweboy.github.io · Personal blog · on HN since 2015

    Jroweboy is a programmer who wrote a post on cases where main in C is not a function, using assembly tricks.

    Visit blogHN submissions
    ProgrammingLanguages & Compilers
    What HN says

    HN commenters link the 2015 post as an entertaining C oddity and question whether its tricks still work with modern compilers.

    Stats for nerds
    18HN people shared it
    11linked in comments
    713story points
    Mar 2023last shared
    2017people per year2023

    Top posts on HN

    1. 1
      Main is usually a function – when is it not?
      18 people · 713 points · first shared 2015 · 65 comments on HN

    What HN people wrote when they linked it

    • xliiMar 2022

      I’m disappointed. I expected some obscure edgecase (like “Main is usually a function…” [1]) but instead that’s about scope handling, contract design and responsibility shift.

      “Hello world” method simply calls an API to a text interface. It uses simple call, to a simple interface that is expected to be ever present. I don’t find any bug there. It won’t work if such interface isn’t available, is blocked or doesn’t exist. It won’t work on my coffee grinder nor on my screwdriver. It won’t work on my Arduino because there is no text interface neither.

      Of course, one could argue that user might expect you to handle that error. That’s all about contracts and expectation. How should I deal with that? Is the “Hello world” message such important that the highest escalated scenario should be painted on the sky? I can imagine an awkward social game where we throw each other obscure challenges and call it a bug.

      It’s nitpicking that even such simple code might fail and I get it. It will also fail on OOM, faulty hardware or if number of the processes on the machine hit the limit. Maybe some joker replaced bindings and it went straight to 3D printer which is out of material? _My expectations_ were higher based on the title.

      Now allow me to excuse myself, I need to write an e-mail to my keyboard manufacturer because it seems like it has a bug which prevents it from working when slightly covered in liquid coffee.

      [1]:…

    • robinhoustonAug 2020

      The author says “I tried to define ‘main’ as an array of shorts with a modern compiler and it did not like that one bit”, but without saying which modern C compiler or what it didn’t like about it.

      This sort of trick should still be possible with modern compilers. GCC has the charming warning

      warning: ‘main’ is usually a function [-Wmain]

      if main is declared as something other than a function.

      Here’s someone who got it to work in 2015, anyway: http://jroweboy.github.io/c/asm/2015/01/26/when-is-main-not-a-function.html

    • Teknoman117Mar 2023

      Makes me think of the "when is main not a function" article from 2015:

      http://jroweboy.github.io/c/asm/2015/01/26/when-is-main-not-a-function.html

    • signa11Sep 2018

      on similar lines, i find this http://jroweboy.github.io/c/asm/2015/01/26/when-is-main-not-a-function.html quite entertaining !

    • lfowlesSep 2017

      Very similar, here's main() as an array

      http://jroweboy.github.io/c/asm/2015/01/26/when-is-main-not-a-function.html

    • andreareinaAug 2020

      Might have to make code const: http://jroweboy.github.io/c/asm/2015/01/26/when-is-main-not-a-function.html

    Related

    Jeremy Bowersjerf.org78 people

    Functors and Monads for People Who Have Read Too Many “Tutorials”

    Jeremy Bowers
    Personal · last shared 2026
    Simple Programmersimpleprogrammer.com72 people

    The Hacker News Generation (Afraid of Hard Work)

    Simple Programmer
    Personal · last shared 2025
    John D. Cookjohndcook.com648 people

    Organizing complexity is the most important skill in software development

    John D. Cook
    Personal · last shared 2026
    Andrew Kelleyandrewkelley.me155 people

    Statically Recompiling NES Games into Native Executables with LLVM and Go

    Andrew Kelley
    Personal · last shared 2026
    Jeremy Kunjeremykun.com194 people

    A Programmer's Introduction to Mathematics

    Jeremy Kun
    Personal · last shared 2026
    FP Complete Blogfpcomplete.com201 people

    Monads and GATs in Nightly Rust

    FP Complete Blog
    Company · last shared 2025
    beza1e1beza1e1.tuxen.de120 people

    A collection of things that are Turing-complete by accident (2013)

    beza1e1
    Personal · last shared 2026
    Scattered Thoughtsscattered-thoughts.net186 people

    Against SQL

    Scattered Thoughts
    Personal · last shared 2026