In my C++ code I have an expression where I multiply unsigned long integer to an int to assign the result to unsigned long int. I am getting a warning as 'overflowed returned value'. I tried to cast the int to unsigned long but it did not help. Any suggestions...
The expression is something like this-
uint64_t size = 0;
uint64_t value = getvalue();
int pageSize= getPageSize();
size = value*(uint64_t)pageSize;
The following should do the job:
size = value*(uint64_t)(unsigned int)pageSize;