Article View: comp.std.c
Article #3672Re: Parenthesis with return ?
From: John Woods
Date: Mon, 07 Aug 1995 16:59
Date: Mon, 07 Aug 1995 16:59
26 lines
1798 bytes
1798 bytes
denis_r@epita.fr (Frank DENIS (Jedi/Sector One)) writes: >As I saw that "return" doesn't seem to need parenthesis around its >return value, I've never used them : ... >But it appears that may coders add them anyway : ... >So I was wondering what was the right thing to do .. Despite it looks >quite strange without these parenthesis, all C compilers are fine >working like that and this is surely the right norm. >But in the next release of the C standard, would these parenthesis be >required or will they still be optional ? It's a good bet they will still be optional (and you're right, they're 100% optional). Probably many coders add them because the parentheses are required in other languages they're used to, and it's certainly legal to do it that way. (Most of the rest of the people in that habit have probably only seen C code written that way, and either think it's mandatory or just do it out of habit.) It's kind of like sizeof operator, where in 99% of all programs, you'll see sizeof expression written as sizeof(expression), even though those parentheses aren't required either[*]; note that when you see ``sizeof( int )'', what you are really looking at is ``sizeof CAST'', not ``sizeof( TYPE )''. But many people simply always write sizeof( something ), even when something is an expression rather than a type name. [*] Unless they're a required part of the expression, like ``(a + 4)''.
Technical Details
Message-ID:
<DCy9uG.CEr@proteon.com>Path:
arc1-ca.pugleaf.net!monk.proteon.com!jfwReferences:
<405fhs$iin@boson.epita.fr>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!monk.proteon.com!jfw From: jfw@proteon.com (John Woods) Subject: Re: Parenthesis with return ? Message-ID: <DCy9uG.CEr@proteon.com> Sender: news@proteon.com Nntp-Posting-Host: kerplop.proteon.com Organization: Proteon, Inc., Westborough, Ma. References: <405fhs$iin@boson.epita.fr> Date: Mon, 7 Aug 1995 16:59:04 GMT