This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

warning C108: '=': possible value truncation

Hello,

there might be an undetected overrun in the result of 'a * b'.
So i used the cast ((unsigned long long int)a to force the result of 'a * b' to long long.
Unfortunately this compiler warning.

unsigned int n,a,b,c;
//*************************************************************************
void main(void)
{
        a = 1;
        b = 1024;
        printf("Hello\n");
        for(n=0;n<8;n++)
        {
                c = ((unsigned long long int)a * b) >> 10;
                printf("%u %10u %10u\n",n,a,c);
                a *= 10;
        }
        while(1){}
}


Should I ignore the warning?
or better how to work around?

0