warning C2705 - cw10.1

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

warning C2705 - cw10.1

跳至解决方案
884 次查看
roberto_m
Contributor III

Hi to all,

In my new «adventure» with  CW10.1 (porting a project, based on hcs08 qe64,  from CW 6.3), I meet a lot of «warnings».

Warnings (they weren't with CW 6.3) are generated by:

 

TPM1C2SC &= ~TPM1C2SC_CH2F_MASK;

 

I think because (from help)

 

CodeWarrior for Microcontrollers V10.x > HCS08/RS08 for Microcontrollers > RS08 Build Tools Reference Manual > Porting Tips and FAQs

 

Number Formats

Valid constant floating number suffixes are f and F for float and l or Lfor long double. Note that floating constants without suffixes are double constants in ANSI. For exponential numbers e or E has to be used. - and + can be used for signed representation of the floating number or the exponent.

The following suffixes are supported (Table A.2):


Table A.2 Supported number suffixes

ConstantSuffixType
floating
F
float
floating
L
long double
integral
U
unsigned in t
integral
uL
unsigned long

 

#define TPM1C2SC_CH2F_MASK              128U

 

U => implies unsigned int (16 bit). Registers of qe64 are 8 bit wide.

How can I avoid C2705 without disable it (with #PRAGMA)?

标签 (1)
标记 (1)
0 项奖励
1 解答
552 次查看
CrasyCat
Specialist III

Hello

 

     You can use an explicit cast to tell the compiler you want the value to be treated as 8-bit value.

 

CrasyCat

在原帖中查看解决方案

0 项奖励
2 回复数
553 次查看
CrasyCat
Specialist III

Hello

 

     You can use an explicit cast to tell the compiler you want the value to be treated as 8-bit value.

 

CrasyCat

0 项奖励
552 次查看
roberto_m
Contributor III

Yes, this is a way.

 

But why use in mc9s08qe64.h « - 18.05.2010, V2.32  - MISRA compliance: U/UL suffixes added to all numbers (_MASK,_BITNUM and addresses) » that implies 16-bit vaule even if qe64 is an 8-bit mcu?