| ??? 04/25/03 16:35 Read: times |
#44248 - Keil C-251 data area questions |
Hi,
Is this a valid construct in you Keil C-251 compiler? unsigned char data buf[20]; typedef struct { int i; int j; } TEST_T; #define GetStruct() (*(TEST_T *)&buf[2]) void Test(void) { GetStruct().i = 3; } Notice that buf is in the data area and I'm type casting it to a TEST_T struct in the default memory area (which is in far). V3.53 of the compiler compiles buggy code when similar scheme is used. If I change the buf memory area to "near", or if I change the macro to #define GetStruct() (*(TEST_T data *)&buf[2]) then it compiles good code. Question is, was there something fundamentaly wrong with what I did in the macro? Andy |
| Topic | Author | Date |
| Keil C-251 data area questions | 01/01/70 00:00 | |
RE: Keil C-251 data area questions | 01/01/70 00:00 |



