Empty parameter lists
来源:互联网 发布:js 点击按钮执行函数 编辑:程序博客网 时间:2024/05/18 13:30
C distinguishes between a function declared with an empty parameter list and a function declared with a parameter list consisting of onlyvoid. The former is an unprototyped function taking an unspecified number of arguments, while the latter is a prototyped function taking no arguments.
// C code extern int foo(); // Unspecified parameters extern int bar(void); // No parameters void baz() { foo(0); // Valid C, invalid C++ foo(1, 2); // Valid C, invalid C++ bar(); // Okay in both C and C++ bar(1); // Error in both C and C++ }
C++, on the other hand, makes no distinction between the two declarations and considers them both to mean a function taking no arguments.
// C++ code extern int xyz(); extern int xyz(void); // Same as 'xyz()' in C++, // Different and invalid in CFor code that is intended to be compiled as either C or C++, the best solution to this problem is to always declare functions taking no parameters with an explicitvoid prototype. For example:
// Compiles as both C and C++ int bosho(void) { ... }Empty function prototypes are a deprecated feature in C99 (as they were in C89).
Refer to http://david.tribble.com/text/cdiffs.htm
- Empty parameter lists
- RequestParam.value() was empty on parameter 0
- Methods with Empty/One Argument Lists
- Learning Perl: 4.6. Variable-Length Parameter Lists
- Error in web interface :Got empty string from [****] IP [****] Parameter
- 【Java】jdk1.7 trustAnchors parameter must be non-empty
- empty()
- empty
- empty
- empty
- empty
- xifre客户端报错 the trustAnchors parameter must be non-empty 异常
- Parameter
- C#SSH.NET连接报错"value cannot be null All lists either null or empty"
- 关于C++编译静态模板成员数据出错 Too few template-parameter-lists
- c++ 模板 迭代器 使用问题解决方法(too few template-parameter-lists)
- Lists
- Name for parameter binding must not be null or empty! On JDKs < 8, you need to use @Param for named
- URAL 1075. Thread in a Space
- JS代码判断IE6,IE7,IE8,IE9!
- java.lang.NoClassDefFoundError: com/opensymphony/xwork2/util/TextUtils
- 有关USES_CONVERSION
- iOS NSString正常显示GBK编码字符
- Empty parameter lists
- Fedora 安装 Adobe Flash
- 软件测试与质量保障之间的关系
- Freebsd 下的 rc.d 里的 脚本模版
- C# 检查是否联网
- windows apache virtualhost
- C实现结构体的继承(转)
- 静态IP与动态IP
- POJ 2377 Bad Cowtractors(Kruskal算法)