CWv8 byte pointer

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

CWv8 byte pointer

2,063 次查看
admin
Specialist II
I use CW for 56800E. In the following line I try to store address in bytes of name2 into var_addr (e.g. if name2 address 0x13b -> var_addr=0x276).
const int var_addr = (const int)((byte*)&name2);
In version 7.3 this code works fine
In version 8 (byte*) convertion seems to be ignored and in var_addr is word pointer (i.e. 0x13b)
Is this a compiler bug or I missed something?
标签 (1)
标记 (1)
0 项奖励
回复
2 回复数

453 次查看
admin
Specialist II
I contacted freescale support and received the answer.
This is a problem of compiler. It appeares if we initialize the variable for address inside a function.
So, wait bug fixes.
Also i get the following (temporarily) solution:

We must define global variables outside a function, but we can initialize them inside a function.
0 项奖励
回复

453 次查看
Alban
Senior Contributor II
Thanks for informing us of the progress Alexey !
I'll be careful now :smileytongue:
 
Alban.
0 项奖励
回复