什么是以下code呢? [英] What does the following code do?

查看:123
本文介绍了什么是以下code呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

static void llist_dtor(void *user, void *element)
{
  (void)user;
  (void)element;
  /* Do nothing */
}

难道没有操作功能?那么,为什么是铸造呢?是否确定传递NULL作为它的一个参数?

Is it no-operation function? Then why is casting done? Is it ok to pass NULL as one of its parameters?

推荐答案

这的确是一个空操作。石膏为(无效)来这里是为了避免让参数从来没有使用过警告一些编译器(石膏被优化掉,但参数仍然被认为是拿来主义 )。

That's indeed a no-op. The casts to (void) are here to avoid getting "parameter never used" warnings with some compilers (the casts are optimized away, but the parameters are still considered as "used").

您可以通过 NULL ,因为参数被忽略反正

You can pass NULL since the parameters are ignored anyway.

这篇关于什么是以下code呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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