0
我读的源代码的基准工具,在这里面我看到:C++在声明后将int转换为void类型?
int i, j, ret; (void)j; (void)ret;
if (!_does_file_exist(str)) {
sprintf(cmd, "mkdir -p %s > errorlog.txt", str);
ret = system(cmd); // Execute a command on the system
(void)ret;
}
是什么声明和铸造整数为void类型的好处/影响?
这似乎无意义。
不幸的是,从[this commit](https://github.com/couchbaselabs/ForestDB-Benchmark/commit/c1e8b277199b5d141bc67a8af304ae60a4501e68)上的基准测试中,我想你可能就在那里。 – slugonamission
我可以看到采取ret变量并继续检查返回值。至少现在我知道他们在做什么:D –