Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Sort of trivial code challenge - may be interesting to you anyway Date: Wed, 04 Mar 2026 11:25:05 -0800 Organization: None to speak of Lines: 25 Message-ID: <87o6l3jt2m.fsf@example.invalid> References: <10n80sc$3soe4$1@dont-email.me> <86v7feei2e.fsf@linuxsc.com> <10o53k6$1i0ef$2@dont-email.me> <86ms0peby6.fsf@linuxsc.com> <10o6nci$21m76$1@dont-email.me> <86a4wpdmfi.fsf@linuxsc.com> <10o9c3n$2ul3p$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Wed, 04 Mar 2026 19:25:06 +0000 (UTC) Injection-Info: dont-email.me; posting-host="a132efd78a76e9218f6fcd00d1f9ddce"; logging-data="3356702"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+FMF+l0iQ4AiEQMB3VsVWB" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:b5kUBcvTQJxoYJXR7mNdf0X4F5s= sha1:T0GHatLDmxAwX7mS+g/qykyF7TY= Xref: csiph.com comp.lang.c:396767 DFS writes: > On 3/3/2026 9:20 AM, Tim Rentsch wrote: >> DFS writes: >>> Is main() OK? >> Yes, sorry, not mentioning main() was an oversight on my part. >> (Still not okay to call it.) > > I was actually kidding, but I see online you can do some trickery to > make a standalone C program work without main(). > > Why? Just for s's and giggles? [...] I'm curious what you're referring to. It's not possible to have a working *portable* C program (for a hosted implementation) without a main function. There might be some compiler-specific tricks for using or specifying an entry point with a different name. For freestanding implementations, the name and type of the entry point are implementation-defined, and portability goes out the window. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */