在头函数声明中传递常量
我继承了大约 1000 个用 C++ 编写的文件,我不得不勉强将其转换为 C。在其中一个头文件中,声明了一个函数,
errnum DSPAPI aaCxSVD(complexnum *input_matrix,[...],intnum jobz=0);
该函数在 XCode 中会产生以下编译错误:
error: expected ';', ',' or ')' before '=' token
如果我简单地执行 intnum 0
,我得到:
error: expected ';', ',' or ')' before numeric constant
如果我删除 intnum,我得到:
error: expected declaration specifiers or '...' before numeric constant
在 C 文件本身中,如果 jobz = 0 或不返回不同的结果。目前,它是唯一提到该功能的标题。
因此我的问题是:有没有合法的方法可以做到这一点?有必要吗?
I've inherited about 1000 files that were written in C++ which I had to grudgingly convert to C. In one of the header files, a function is declared as
errnum DSPAPI aaCxSVD(complexnum *input_matrix,[...],intnum jobz=0);
which yields the following compilation error in XCode:
error: expected ';', ',' or ')' before '=' token
if I simply do intnum 0
, I get:
error: expected ';', ',' or ')' before numeric constant
if I remove intnum, I get:
error: expected declaration specifiers or '...' before numeric constant
In the C file itself, different results get returned if jobz = 0 or not. Currently, it's the only header that ever mentions that function.
My question is thus: is there any legal way of doing this? is it even necessary?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
jobz
已被赋予默认值。这是仅限 C++ 的功能。我想说,转换它的最简单方法就是删除
=0
。然后,找到在不提供显式最终参数的情况下调用aaCxSVD()
的所有位置,并添加0
。jobz
has been given a default value. This is a C++-only feature.I would say that the easiest way to convert this is simply to remove the
=0
. Then, find all locations whereaaCxSVD()
is being called without providing an explicit final parameter, and tack on0
.