Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 31 Aug 2012 09:30:02 -0500 Return-Path: Sender: std-cpp-request@vandevoorde.com Approved: stephen.clamage@oracle.com Message-ID: <503FADD2.80702@verizon.net> Newsgroups: comp.std.c++ From: James Kuyper Subject: Re: Unused named function argument Organization: A noiseless patient Spider References: <61b7661d-5cbf-4246-93a2-4ab9dcc6ed12@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1 X-Original-Date: Thu, 30 Aug 2012 14:15:46 -0400 X-Submission-Address: std-cpp-submit@vandevoorde.com To: undisclosed-recipients:; Date: Fri, 31 Aug 2012 09:20:17 CST Lines: 47 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-e6nmnG2HoXQJngO5kieI7P9qYkQAPfTpsQQJ1j4rjmuCsQ9eOHuACxMSHKXnrFT6ic/CWPxwW7B6bh1!Kt4FmzN7o7a+HffRQKJHW1aw3My7tZ/ojMb6n2mlMOceTnkCLgM= X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2872 Xref: csiph.com comp.std.c++:540 On 08/30/2012 12:36 PM, andrew.gottemoller@debesys.net wrote: > > When compiling using gcc with, the below code will compile without any sort of error: > > > int foo (int) > { > return 5; > } > > > Can the compilation result differ if I specify a name for the argument? > > I can't see any way the naming of the parameter would ever make a difference in the actual compilation result. The question arose because I noticed when compiling the following C program: > > > // Compile: gcc --std=c99 -c -pedantic -Wall -O3 foo.c > int foo (int) > { > return 5; > } > > > The error: 'parameter name omitted' is output by the compiler. > > Is there any non-obvious significance in the parameter name with C++11 or C99? In n1570 (which is very close to C2011) 6.9.1p5 is a constraint applying to function definitions: "If the declarator includes a parameter type list, the declaration of each parameter shall include an identifier, except for the special case of a parameter list consisting of a single parameter of type void, in which case there shall not be an identifier. ..." The C99 wording was identical. 6.9.1p6 says equivalent things about K&R style function declarations, which are still allowed. I could find no comparable wording in the C++ standard, so this may not be true of C++11. -- [ comp.std.c++ is moderated. To submit articles, try posting with your ] [ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ] [ --- Please see the FAQ before posting. --- ] [ FAQ: http://www.comeaucomputing.com/csc/faq.html ]