Path: ...!news-out.netnews.com!postmaster.netnews.com!us12.netnews.com!not-for-mail X-Trace: DXC=J4_3n=N1laWgmNYUbPUfV`L[ofA1LK4QL]XbgVP6X<4Dm]VImggNeQQDR^WjB\Oa:X5b?f8X X-Complaints-To: support@blocknews.net Date: Mon, 17 Jun 2024 08:50:06 -0400 MIME-Version: 1.0 User-Agent: Betterbird (Windows) From: DFS Subject: Re: Whaddaya think? Newsgroups: comp.lang.c References: <666ded36$0$958$882e4bbb@reader.netnews.com> <87ed8x4zjl.fsf@nosuchdomain.example.com> <666f10b7$0$1412896$882e4bbb@reader.netnews.com> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Lines: 38 Message-ID: <667030fa$0$7079$882e4bbb@reader.netnews.com> NNTP-Posting-Host: 127.0.0.1 X-Trace: 1718628603 reader.netnews.com 7079 127.0.0.1:36845 Bytes: 2470 On 6/16/2024 10:41 PM, James Kuyper wrote: > On 6/16/24 12:20, DFS wrote: >> On 6/15/2024 6:22 PM, Keith Thompson wrote: >>> DFS writes: > ... >>>> return(0); >>> >>> A minor style point: a return statement doesn't require parentheses. >>> IMHO using parentheses make it look too much like a function call. I'd >>> write `return 0;`, or more likely I'd just omit it, since falling off >>> the end of main does an implicit `return 0;` (starting in C99). >> >> Can't omit it. It's required by my brain. > > The parentheses you're putting in are completely unrelated to the use of > parentheses in _Generic(), function calls, compound literals, > sizeof(type name), alignof(), _BitInt(), _Atomic(), typeof(), > typeof_unqual(), alignas(), function declarators, static_assert(), if(), > switch(for(), while(), do ... while(), function-like macro definitions > and invocations or cast expressions. In all of those cases, the > parentheses are part of the grammar. > > The parentheses that you put in return(0) serve only for grouping > purpose. They are semantically equivalent to the parentheses in "i = > (0);"; they are just as legal, and just as pointless. > > If your brain doesn't immediately understand why what I said above is > true, I recommend retraining it. I meant omit a return altogether. But looking around, I rarely see return(0). Don't know why it became a thing for me. Moving forward, return 0 it is.