Home > Software engineering >  Operation problems in thread (no points, please forgive me)
Operation problems in thread (no points, please forgive me)

Time:11-25

 count=0; 
For (j_v=0; J_v & lt; Csize; J_v + +)
{
Unsigned short code, fact, insize;
Code=charcode [j_v];
Fact=n;
Insize=num;
Int ii=((fact) code * % insize);
Index_s [ii] + +; count++;
}

If (count!=csize)
{
Count=1;
}
//addup
Count=0;
For (int k=0; K & lt; Num. K++)
{
For (int IP=0; IP & lt; 20; Ip++)
{
If (index_s [k]==IP)
{
P [IP] + +;
break;
}
}
The count +=index_s [k].
}
If (count!=csize)
{
Count=1;//debug1
}
Count=0;
For (int kk=1; Kk & lt; 20; Kk++)
{
Count +=p (kk);
}
If (count & gt; Csize)
{
Count=1;
}

This is a thread in the code, and in principle should never perform DEBUG1 that line, where all variables are local variables have no other reference, charcode is an unsigned short an array of type

CodePudding user response:

Found the reason, ii variables beyond, this is even more confused, because insize variable is only 113, and the value of more than 60000 ii? Is ready, change the type to an unsigned int...

CodePudding user response:

Code is not complete, can't judge, at first how much value of num

CodePudding user response:

The operational benefits?
Add the ASSERT (xx & gt;=0 & amp; & Xx & lt; Yy) assertions look

CodePudding user response:

refer to the second floor SuperDay response:
code is not complete, can't judge, how much the start value of num

Num is very small, less than 1000, the value of num does not change in the computing

CodePudding user response:

Can solve

CodePudding user response:

reference zgl7903 reply: 3/f
operation benefits?
Add the ASSERT (xx & gt;=0 & amp; & Xx & lt; Yy) assertions look

Don't understand the VC compiler to play what pattern, the same operation in MDK is correct
  • Related