Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Calling exit in main Date: Fri, 25 Jun 2021 00:48:58 -0700 Organization: None to speak of Lines: 22 Message-ID: <87mtrev0yd.fsf@nosuchdomain.example.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: reader02.eternal-september.org; posting-host="e76a60976a03f7b22ccc859f0f74fb19"; logging-data="15883"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/MiwzXM6ltjENDNIqKXhgX" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:3HJ8IRNwzqVc9m6HXeDsrWWJiPg= sha1:j4ACJLw884VDaymK5Xg7YP0eRY8= Xref: csiph.com comp.lang.c:161491 Kli-Kla-Klawitter writes: > Am 25.06.2021 um 08:16 schrieb Mehdi Amini: >> I looked at some code on the Internet similar to this: >> #include >> #include >> int main(void) >> { >>     printf("Calling exit in main\n"); >>     exit (0); >> } >> Both gcc and clang issue no diagnostic about it. Do you think it is >> proper to use exit instead of return in main ? > > There's a race-condition here: > will the program crash sooner than it exit()s? There is no race condition. Why do you think the program would crash? -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Philips Healthcare void Void(void) { Void(); } /* The recursive call of the void */