syntax - What could be case of use `int x = x;` expression (C language)? -


i have lib written in c. in code found few lines int x = x;. need rewrite pieces of code compilation /zw flag. in places mean's int x = some_struct->x;, in cases don't understand it. in places first use of x variable. in cases used such int x = x; expression.

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 if there no coded fragments; otherwise we'd flush        trailing eob run ac 1 list , never read 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 trailing eob run 1st ac coefficient.       needed allow track tokens end of list.*/     eob_run1=_enc->eob_run[_pli][1];     if(eob_run1>0)oc_enc_eob_log(_enc,_pli,1,eob_run1);     /*if there active eob run @ start of 1st ac stack, read        in , decode it.*/     if(_prev_eob_run1>0){       token1=dct_tokens1[ti1r];       eb1=extra_bits1[ti1r];       ti1r++;     eob_run1=oc_decode_eob_token(token1,eb1); 

code exaple - variable token1 - it's first use of token1 in file , token1 never meets in other files, it's not global, not static anywhere...

update
with /zw flag:error c4700: uninitialized local variable 'token1' used
without flag: works fine lib
update 2
it's theora 1.1.1 lib
resume
on advice of guys in comments, replace every int x = x; int x = 0 , works fine =) thanx answers

if literally have int x = x;, there isn't use of it. piece attempts initialize x itself, is, value of uninitialized variable.

this may suppress compiler warnings/errors related uninitialized or unused variables. compilers can catch these dubious cases well.

this results in undefined behavior c standard's view point.

edit: random number bug in debian linux article (with further links) use , abuse of uninitialized variables , price 1 may pay 1 day.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -