调用函数[repicate]中的一个char指针。

问题描述 投票:0回答:1

我看到了那段代码 但不知道目的是什么。

void a()
{
  static const char *string = "STRING";
  ...
  (void)string;  // <---- What the purpose of the line is?
  ...
}
c string void
1个回答
0
投票

(void) 在这样的变量前会创建一个空的表达式,用来沉默程序没有使用变量的警告。

在这种特殊情况下,最好是简单地注释掉变量声明。

© www.soinside.com 2019 - 2024. All rights reserved.