(显然)为空,C函数的使用 [英] Use of (apparently) empty C function

查看:145
本文介绍了(显然)为空,C函数的使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以在下面的函数,这似乎并不十分的评论点

Can anyone comment on the point of the following function, which appears to do not very much:

// Returns stored values
int getDetails(const int param1[],
               int* param2,
               int* param3,
               int* param4)
{
    (void)param1;
    (void)param2;
    (void)param3;
    (void)param4;
    return 0;
}

注释是居然还有与code。我想那一定是某种奇怪的存根,但它被调用,我绞尽脑汁,试图想象我错过了什么。

The comment is actually there with the code. I'm thinking it must be some kind of odd stub but it is being called and I'm racking my brains to try to imagine what I'm missing.

我最好的预感到目前为止,该功能已经去precated但不删除,(无效)参数是为了避免对未使用的变量编译器警告。

My best hunch so far is that the function has been deprecated but not removed and the (void)param is to avoid compiler warnings about unused variables.

推荐答案

之类的语句(无效)参数1; 通常被用来燮有关未使用的函数preSS警告参数。 (顺便说一句,在C ++中,你也可以注释掉或删除参数名。)

Statements like (void)param1; are typically used to suppress warnings about unused function parameters. (As an aside, in C++ you could also comment out or remove the parameter names.)

你是正确的,因为函数什么都不做。如果其他code不创建一个指向它,你可以放心地将其删除。

You're correct that the function does nothing. If other code doesn't create a pointer to it, you could safely remove it.

这篇关于(显然)为空,C函数的使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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