How many bytes are the variables in CW10.6

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

How many bytes are the variables in CW10.6

跳至解决方案
1,809 次查看
jorgesierra
Contributor II

I just wanted to cross check an answer to something I came across on the web.

c++ faq - What does the C++ standard state the size of int, long type to be? - Stack Overflow

 

In the answers they give a range of numbers which the variables have to be. If I convert these variables into HEX will it give my how big the variables are in bytes?

标签 (1)
1 解答
1,629 次查看
TICS_Fiona
NXP Employee
NXP Employee

Hello Jorge

For MK10DX256VLH7, CodeWarrior v10.6.4 includes both GCC compiler and Freescale compiler.

In general, the data type information should be included in the compiler manual for each MCU platform.

But, in the documents in CW 10.x, this manual does not include such information. I need report it to the document team.

For the data type information of Kinetis, you can get it from attached header file limits_api.h

(it locates at:

{cw 10.x}MCU\ARM_GCC_Support\ewl\EWL_C\include

{cw 10.x}MCU\ARM_EABI_Support\ewl\EWL_C\include

).

From them, we can get the size for data type is:

char – 8 bit

short – 2 bytes

int – 4 bytes

long – 4 bytes

long long – 8 bytes

Fiona Kuang

Technical Information & Commercial Support

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

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

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

在原帖中查看解决方案

3 回复数
1,629 次查看
TICS_Fiona
NXP Employee
NXP Employee

Hello Jorge

The size of data type is determined by processor architecture and the compiler, what is the part number of your target MCU? And what development environment you are using?

Fiona Kuang

Technical Information & Commercial Support

0 项奖励
回复
1,629 次查看
jorgesierra
Contributor II

MCU: MK10DX256VLH7

IDE: Codewarrior 10.6.4

0 项奖励
回复
1,630 次查看
TICS_Fiona
NXP Employee
NXP Employee

Hello Jorge

For MK10DX256VLH7, CodeWarrior v10.6.4 includes both GCC compiler and Freescale compiler.

In general, the data type information should be included in the compiler manual for each MCU platform.

But, in the documents in CW 10.x, this manual does not include such information. I need report it to the document team.

For the data type information of Kinetis, you can get it from attached header file limits_api.h

(it locates at:

{cw 10.x}MCU\ARM_GCC_Support\ewl\EWL_C\include

{cw 10.x}MCU\ARM_EABI_Support\ewl\EWL_C\include

).

From them, we can get the size for data type is:

char – 8 bit

short – 2 bytes

int – 4 bytes

long – 4 bytes

long long – 8 bytes

Fiona Kuang

Technical Information & Commercial Support

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

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

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