Inconsistent Warning Message C2705

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Inconsistent Warning Message C2705

852 次查看
rayhall
Contributor V

Hello,

 

I am getting this warning only for some of basically the same code. "Warning C2750: Possible loss of data"

I can disable the message, but would prefer not to do this. What is wrong ?

 

TIM_TFLG1 &= ~(1<<TIM_TFLG1_C0F_MASK); // No warning

TIM_TFLG1 &= ~(1<<TIM_TFLG1_C1F_MASK); // No warning

TIM_TFLG1 &= ~(1<<TIM_TFLG1_C2F_MASK); // No warning

 

TIM_TFLG1 &= ~(1<<TIM_TFLG1_C3F_MASK); // Get Warning C2705

TIM_TFLG1 &= ~(1<<TIM_TFLG1_C4F_MASK); // Get Warning C2705

 

TIM_TFLG1 &= ~(1<<TIM_TFLG1_C5F_MASK); // No warning

 

The micro is the S12XE.

 

Ray.

标签 (1)
0 项奖励
回复
1 回复

675 次查看
TICS_Fiona
NXP Employee
NXP Employee

Hello Ray

What is the data type of TIM_TFLG1_C0F_MASK~ TIM_TFLG1_C5F_MASK, and what is the data type of TIM_TFLG1?   We need to the code context to dig out the reason.

By default, the compiler uses 16bit for the operand “1”of the <<operator in your code. So please add the typecast for this kind of operation to get rid of the warning.

Best Regards

Fiona Kuang

TIC - Technical Information Center

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Mark Correct button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复