无效论证 [英] void argument

查看:103
本文介绍了无效论证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我知道有一个区别(在C中)


int fun(void);


int fun();


第一个不带参数。第二个可以使用任意数量的
参数,包括0.


我想知道这个差异是否仍然存在于C ++中。


谢谢,



Hi,

I know that there is a difference (in C) between

int fun(void);

int fun();

The first one takes no arguments. The second can take any number of
arguments, including 0.

I''m wondering if this difference is still hold in C++.

Thanks,
Peng

推荐答案

Pe ******* @ gmail.com 写道:

我知道有一点不同(在C中)

(无效);

int fun();

第一个一个不参数。第二个可以使用任意数量的参数,包括0.

我想知道这个差异是否仍然存在于C ++中。
Hi,

I know that there is a difference (in C) between

int fun(void);

int fun();

The first one takes no arguments. The second can take any number of
arguments, including 0.

I''m wondering if this difference is still hold in C++.




不,他们在C ++中是完全相同的:乐趣不带参数。对于

,使用任意数量参数的函数使用省略号,例如:虚无趣(...);


雅克。



Nope, they''re exactly the same thing in C++: fun takes no arguments. For
a function taking any number of arguments use ellipses, e.g. void fun(...);

Jacques.


< Pe ******* @ gmail。 COM>在消息中写道

news:11 ********************** @ g44g2000cwa.googlegr oups.com ...
<Pe*******@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...


我知道有一点不同(在C中)

int fun(void);

int fun ();

第一个不带参数。第二个可以包含任意数量的参数,包括0.

我想知道这个差异是否仍然存在于C ++中。

谢谢,
Peng
Hi,

I know that there is a difference (in C) between

int fun(void);

int fun();

The first one takes no arguments. The second can take any number of
arguments, including 0.

I''m wondering if this difference is still hold in C++.

Thanks,
Peng




不,在C ++中它们的意思相同:一个不带参数的函数。在C ++中不允许使用任何数量的参数进行
业务。因为

的重载,参数类型是函数签名的一部分。


-

Cy
http://home.rochester.rr.com/cyhome/


No。


[nan @ athena test]
No.

[nan@athena test]


这篇关于无效论证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆