“无功能呼叫"是什么意思? [英] What does 'call of nonfunction mean?

查看:108
本文介绍了“无功能呼叫"是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

调用非函数意味着在c ++中是什么?请告诉.

Call of nonfunction means what in c++? Please tell.

推荐答案

这意味着您正在尝试调用不是函数的东西.例如:

It means you are trying to call something that is not a function. For instance:

int c;
c(); // this is a call to a nonfunction


为Nemanja Trifunovic的正确答案添加一些解释:

在编译器错误消息中提及调用非功能"并不意味着确实存在调用非功能,而是以某种方式存在.哪有这回事.在C ++中,您只能调用一个函数.错误消息简单的意思是这是胡言乱语",但是编译器看到了类似于调用的语法(仅由于()"),并建议程序员确实打算进行调用,但不小心写了一个错误的标识符(非标识符) -可调用.

对于一条记录,如果您在类中重写了一个调用运算符()",那么您也可以使用类似调用的语法,但这仍然是对该函数的调用.例如,请参见: ^ ].

—SA
To add a little explanation to the correct answer by Nemanja Trifunovic:

Mention in the compiler error message "call of nonfunction" does not mean a call of non-function really exists but somehow exists. There is no such thing. In C++, all you can call is always a function. The error message simple means "this is gibberish" but a compiler sees a call-like syntax (just because of "()" ) and suggests that a programmer really meant to make a call but have accidentally written a wrong identifier — of something non-callable.

For a record, you can also use the call-like syntax if you override a call operator "()" in your class, but this is a call of the function anyway. See, for example: http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8a.doc%2Flanguage%2Fref%2Fcplr327.htm[^].

—SA


这篇关于“无功能呼叫"是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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