在看 dropbox 的 json11 源码,json11 是 dropbox 公司开源的 C++解析 json 的库。
地址在 https://github.com/dropbox/json11
其中有一处的写法很奇怪(json11.cpp, line632 - line651)
https://github.com/dropbox/json11/blob/master/json11.cpp#L651
while (1) {
i--;
data.push_back(parse_json(depth + 1));
if (failed)
return Json();
ch = get_next_token();
if (ch == ']')
break;
if (ch != ',')
return fail("expected ',' in list, got " + esc(ch));
ch = get_next_token();
(void)ch;
}
这里的 get_next_token 返的的是一个 char 类型,即 ch 就是一个普通的 char 类型
我的问题是,最后一行,单独的一行( https://github.com/dropbox/json11/blob/master/json11.cpp#L651 )
(void)ch;
是什么意思?感觉没有任何作用啊?
谢谢!