Wayne Shumaker

impicit arithmetic conversion warnings

Discussion created by Wayne Shumaker on Dec 13, 2007
Latest reply on Dec 13, 2007 by CompilerGuru
Using CW 6.1 compiling for ColdFire V1 of a project that was converted from HCS08 QE128 project.

Why does the following generate warning:
implicit arithmetic conversion from 'int' to 'unsigned short'

typedef unsigned short uint16_t
typedef uint16_t SystemTime_t

SystemTime_t   systemTimeMs;

inline static SystemTime_t ElapsedTime(SystemTime_t startTime)
{
    return systemTimeMs - startTime;
}

it seems to me that all the parameters are clearly defined as 'unsigned short' and there should be no implicit conversions going on?


Outcomes