473,386 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

what is the difference between these two declarations

Hi,
I was always wondering if there is any difference between

void someFunction(int,int)

and

void someFunction(int A, int B)

is there?
Jul 22 '05 #1
8 1445
Guybrush Threepwood wrote:
Hi,
I was always wondering if there is any difference between

void someFunction(int,int)

and

void someFunction(int A, int B)

is there?


No difference.

Jul 22 '05 #2
On Thu, 26 Feb 2004 22:18:25 +0100, Rolf Magnus <ra******@t-online.de>
wrote:
Guybrush Threepwood wrote:
Hi,
I was always wondering if there is any difference between

void someFunction(int,int)

and

void someFunction(int A, int B)

is there?


No difference.


....assuming they're declarations and the OP simply omitted the semicolons
inadvertently. If they're the first line of function /definitions/,
however, there would certainly be a difference (in the first case, there'd
be no way to access the parameters.)
-leor
Leor Zolman
BD Software
le**@bdsoft.com
www.bdsoft.com -- On-Site Training in C/C++, Java, Perl & Unix
C++ users: Download BD Software's free STL Error Message
Decryptor at www.bdsoft.com/tools/stlfilt.html
Jul 22 '05 #3
"Guybrush Threepwood" <sa***@sco.com> wrote in message
news:c1**********@news8.svr.pol.co.uk...
Hi,
I was always wondering if there is any difference between

void someFunction(int,int)

and

void someFunction(int A, int B)

is there?


None from the language perspective. However, using (meaningful)
parameter names in a prototype can aid clarity.

-Mike
Jul 22 '05 #4

"Mike Wahler" <mk******@mkwahler.net> wrote in message
news:8z*****************@newsread2.news.pas.earthl ink.net...
"Guybrush Threepwood" <sa***@sco.com> wrote in message
news:c1**********@news8.svr.pol.co.uk...
Hi,
I was always wondering if there is any difference between

void someFunction(int,int)

and

void someFunction(int A, int B)

is there?


None from the language perspective. However, using (meaningful)
parameter names in a prototype can aid clarity.


On the other hand, with some compilers not using parameter names can
suppress "unused parameter" warning messages.

Joe Gottman
Jul 22 '05 #5
Guybrush Threepwood wrote:
I was always wondering if there is any difference between

void someFunction(int, int)

and

void someFunction(int A, int B)

is there?


The first can only be a declaration.
The second could be the beginning of a definition.

Jul 22 '05 #6
On Thu, 26 Feb 2004 13:31:24 -0800, "E. Robert Tisdale"
<E.**************@jpl.nasa.gov> wrote:
Guybrush Threepwood wrote:
I was always wondering if there is any difference between

void someFunction(int, int)

and

void someFunction(int A, int B)

is there?


The first can only be a declaration.
The second could be the beginning of a definition.


Both can be declarations (and that's /all/ they'd be if you added a
semicolon), and both can be the beginning of function definitions. There'd
just be no way to get to the parameters in the first case.
-leor
Leor Zolman
BD Software
le**@bdsoft.com
www.bdsoft.com -- On-Site Training in C/C++, Java, Perl & Unix
C++ users: Download BD Software's free STL Error Message
Decryptor at www.bdsoft.com/tools/stlfilt.html
Jul 22 '05 #7

"Leor Zolman" <le**@bdsoft.com> wrote in message
news:re********************************@4ax.com...
On Thu, 26 Feb 2004 13:31:24 -0800, "E. Robert Tisdale"
<E.**************@jpl.nasa.gov> wrote:
Guybrush Threepwood wrote:
I was always wondering if there is any difference between

void someFunction(int, int)

and

void someFunction(int A, int B)

is there?
The first can only be a declaration.
The second could be the beginning of a definition.


Both can be declarations (and that's /all/ they'd be if you added a
semicolon), and both can be the beginning of function definitions. There'd
just be no way to get to the parameters in the first case.
-leor


There's even a common and reasonable use for a declaration and definition
with no
parameter name: operator++(int) - the post increment operator

Leor Zolman
BD Software
le**@bdsoft.com
www.bdsoft.com -- On-Site Training in C/C++, Java, Perl & Unix
C++ users: Download BD Software's free STL Error Message
Decryptor at www.bdsoft.com/tools/stlfilt.html

Jul 22 '05 #8
On Thu, 26 Feb 2004 23:24:19 -0000, "Nick Hounsome"
<nh***@blueyonder.co.uk> wrote:

"Leor Zolman" <le**@bdsoft.com> wrote in message
news:re********************************@4ax.com.. .
On Thu, 26 Feb 2004 13:31:24 -0800, "E. Robert Tisdale"
<E.**************@jpl.nasa.gov> wrote:
>Guybrush Threepwood wrote:
>
>> I was always wondering if there is any difference between
>>
>> void someFunction(int, int)
>>
>> and
>>
>> void someFunction(int A, int B)
>>
>> is there?
>
>The first can only be a declaration.
>The second could be the beginning of a definition.


Both can be declarations (and that's /all/ they'd be if you added a
semicolon), and both can be the beginning of function definitions. There'd
just be no way to get to the parameters in the first case.
-leor


There's even a common and reasonable use for a declaration and definition
with no
parameter name: operator++(int) - the post increment operator


Sure. I use the mechanism in at least three different places in each
version of my InitUtil library:

http://www.bdsoft.com/tools/initutil.html

In those cases, template parameters are only mined for their type
information.
-leor

Leor Zolman
BD Software
le**@bdsoft.com
www.bdsoft.com -- On-Site Training in C/C++, Java, Perl & Unix
C++ users: Download BD Software's free STL Error Message
Decryptor at www.bdsoft.com/tools/stlfilt.html
Jul 22 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: fowlertrainer | last post by:
Hello ! I see these things in many sources, under wxPy: def __init__(self,params,**kw,**args) What are these parameters, and what's the meaning of the double * ? Thanx for any info.
2
by: diadia | last post by:
string s = "hello"; const char *p = s.begin(); cout << p << endl; // print hello s = ""; char *p2= s.begin(); cout << p2 << endl; // print hello why?????
5
by: Steven T. Hatton | last post by:
I'm trying to figure out if this code (which I'm sure was written for a C compiler, could be considered legal C++. My confusion is from the last bit of code at the end. Could someone explain to me...
1
by: Dmitry Tkach | last post by:
Hi, everybody! I have been running a 7.3 database for a couple of weeks... and it has grown by more than 20Gig on me within that interval... I have a copy of the original database (I just copied...
15
by: Walter Dnes (delete the 'z' to get my real address | last post by:
I'm trying to initialize an array of error messages, so that I can print out an error message by using the 'nth string in an array, e.g. printf("%s\n", messages); I'm still hazy on arrays of...
11
by: J Wang | last post by:
dear, I debug the program recently as follows. #include <sys/stat.h> int main(int argc, char *argv) { struct stat buf;
9
by: Jay | last post by:
Everywhere I go (read/browse) I see these parameters.... ByVal sender As Object, ByVal e As System.EventArgs Yet I never see them used within the function/method. Could someone tell me what they...
2
by: Neo | last post by:
Hi, I am new to C++ and want to know what are forward declarations and any site which has a good introductory explanation. thanks in advance, nick
2
by: arthurzzk | last post by:
<bean id="sesFactoryWeb" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"><ref local="XXXXXX"/></property> <property...
5
by: bhushanbagul | last post by:
Hi All Please let me know exactly what difference i and g makes in oracle version i.e. when we say oracle 10g or oracle 11i Thanks Bhushan
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.