AnsweredAssumed Answered

type casting in CW12 V3.1

Question asked by Mark Tverskoy on May 12, 2006
Latest reply on May 18, 2006 by Daniel Lundin
Hi,
 I have the question on typecasting mechanism :
 
 
The simple code is below (small memory model):
 
typedef struct
{
 char low;
 char high;
}SPLIT_T;
 
 
const unsigned char test_ch = (unsigned char )&handler; // Does not work ...storage dest is too small. I understand and would expect that test_ch would contain either msb or lsb of the handler's address!?
 
const SPLIT_T test_split = (SPLIT_T )&handler; // Compiler complaines - illegal typecast ????
 
void handler(void);
 
 
void main(void)
{
...
}
 
void handler(void)
{
...
}
 
Any ideas...
 
Regards, Mark

Outcomes