News for hackers. Stuff that matters.
Re:Exploring mullender.c – A deep dive into the first IOCCC ... by robinhouston on Sunday August 30, 2020 @03:21AM (#24321923)
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-...

Re:Exploring mullender.c – A deep dive into the first IOCCC ... by LainIwakura on Sunday August 30, 2020 @08:39AM (#24322871)
Author of the article here. This was simply meant to be a minor observation, the focus of the article is not an investigation about the various ways to define main in your program.

Anyway, this is the error I got if you're curious. (I left such things out because the article was getting long as is)

warning: variable named 'main' with external linkage has undefined behavior [-Wmain] short main[] = { 16, 18 };

This is on OS X so it's clang 11.0.3.

Re:Exploring mullender.c – A deep dive into the first IOCCC ... by robinhouston on Sunday August 30, 2020 @10:45AM (#24323258)
I’m sorry your comment has been downvoted. I can’t imagine why. Thanks for writing an interesting article.

I realise this was a minor observation on your part, and I was remarking on it in that spirit. I’m sorry not to have made that clearer. I’ve found it rather dispiriting when writing of mine has been posted here, and the comments have seemed like nitpicking criticism, so I regret having given you that impression. One has to remind oneself that people who enjoy the article and have nothing to add will usually not leave comments, and so the comments give a misleading impression of how people felt about it.

The message you quote above appears to be a warning, rather than an error.

Re:Exploring mullender.c – A deep dive into the first IOCCC ... by LainIwakura on Sunday August 30, 2020 @11:41AM (#24323570)
No harm no fowl, I appreciate constructive criticism but sometimes I'm on edge posting in these forums. It's like, this content is being posted to some of the best in the field - I want to be as precise and accurate as I can be.

Anyway, I'm glad you found it interesting =)

Re:Exploring mullender.c – A deep dive into the first IOCCC ... by StavrosK on Sunday August 30, 2020 @04:02AM (#24322048)
> I tried to define ‘main’ as an array of shorts with a modern compiler and it did not like that one bit

He didn't even try to get it to work by changing that one bit!