logoalt Hacker News

Writing a (valid) C program without main()

16 pointsby birdculturetoday at 4:21 PM6 commentsview on HN

Comments

eskatoday at 4:50 PM

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.

asveikautoday at 4:53 PM

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.

show 1 reply
pishpashtoday at 4:58 PM

This isn't making a C program. It's using C tools and assembly tools to make an executable.

show 1 reply