【发布时间】:2013-04-25 10:47:45
【问题描述】:
我有一个用 C 编写的库。在代码中,我发现了几行类似 int x = x; 的代码。我需要重写所有这些代码以使用 /Zw 标志进行编译。在某些地方,这意味着int x = some_struct->x;,但在另一些情况下,我不明白它是什么。在某些地方它首先使用 x 变量。那么在哪些情况下可以使用int x = x;这样的表达式。
void oc_enc_tokenize_dc_frag_list(oc_enc_ctx *_enc,int _pli,
const ptrdiff_t *_coded_fragis,ptrdiff_t _ncoded_fragis,
int _prev_ndct_tokens1,int _prev_eob_run1){
const ogg_int16_t *frag_dc;
ptrdiff_t fragii;
unsigned char *dct_tokens0;
unsigned char *dct_tokens1;
ogg_uint16_t *extra_bits0;
ogg_uint16_t *extra_bits1;
ptrdiff_t ti0;
ptrdiff_t ti1r;
ptrdiff_t ti1w;
int eob_run0;
int eob_run1;
int neobs1;
int token;
int eb;
int token1=token1;
int eb1=eb1;
/*Return immediately if there are no coded fragments; otherwise we'd flush
any trailing EOB run into the AC 1 list and never read it back out.*/
if(_ncoded_fragis<=0)return;
frag_dc=_enc->frag_dc;
dct_tokens0=_enc->dct_tokens[_pli][0];
dct_tokens1=_enc->dct_tokens[_pli][1];
extra_bits0=_enc->extra_bits[_pli][0];
extra_bits1=_enc->extra_bits[_pli][1];
ti0=_enc->ndct_tokens[_pli][0];
ti1w=ti1r=_prev_ndct_tokens1;
eob_run0=_enc->eob_run[_pli][0];
/*Flush any trailing EOB run for the 1st AC coefficient.
This is needed to allow us to track tokens to the end of the list.*/
eob_run1=_enc->eob_run[_pli][1];
if(eob_run1>0)oc_enc_eob_log(_enc,_pli,1,eob_run1);
/*If there was an active EOB run at the start of the 1st AC stack, read it
in and decode it.*/
if(_prev_eob_run1>0){
token1=dct_tokens1[ti1r];
eb1=extra_bits1[ti1r];
ti1r++;
eob_run1=oc_decode_eob_token(token1,eb1);
代码示例 - 变量 token1 - 这是第一次在文件中使用 token1 和 token1 从未在其他文件中遇到过,它不是全局的,也不是任何地方的静态...
更新
使用 /Zw 标志:错误 C4700:使用了未初始化的局部变量 'token1'
没有标志:这个库一切正常
更新 2
这是theora 1.1.1 lib
简历
根据 cmets 人员的建议,我将每个 int x = x; 替换为 int x = 0 并且一切正常 =) 每个人都感谢答案
【问题讨论】:
-
你把我弄丢了。你需要更清楚你正在尝试做什么。还有一些代码示例会有所帮助
-
您能否编辑您的问题以包含一个包含
int x = x;行之一的函数,这让您感到困惑? -
/Zw标志是什么?我想那是 MSVC? -
为什么投反对票?这是一个有效的问题。
-
另请阅读:Point of Declaration
标签: c syntax coding-style