Jacob Christ 0 Posted January 20, 2008 Report Share Posted January 20, 2008 This does not work: #define s8 char #define us8 unsigned char s8 i; for(i = 0; i < sizeof(data); i++) { ((us8 *)&data)[i] = 0; } But this does: #define s8 char #define us8 unsigned char s8 i; us8 *p1; p1 = (us8 *)&data; for(i = 0; i < sizeof(data); i++) { p1[i] = 0; } Jacob Quote Link to post Share on other sites
Pavel 0 Posted January 21, 2008 Report Share Posted January 21, 2008 Thanks for reportng. This is a known problem. Compiler will not apply array element operation [] to an expression that doesn't evaluate to a variable. A workaround is as you described by introducing a temporary variable that will replace the expression and applying array element operation to this variable. Regards, Pavel Quote Link to post Share on other sites
Pavel 0 Posted January 31, 2008 Report Share Posted January 31, 2008 Fixed. Fix will be available in the next release. Regards, Pavel Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.