Andrew Leiper 0 Posted January 28, 2011 Report Share Posted January 28, 2011 Hi Pavel, boostc v7.01 PIC18F2525 Please see the comments in the code below. It seems with this one as if the compiler is ignoring the brackets and so evaluating (-1/2) to give 0. //////////////////////////// #include <system.h> #define BAD1 ((unsigned short)-1) #define BAD2 (BAD1 / 2) #define GOOD1 (0xFFFF) #define GOOD2 (GOOD1 / 2) unsigned short p; void main(void) { p = GOOD1; //p == 0xFFFF as expected p = GOOD2; //p == 0x7FFF as expected p = BAD1; //p == 0xFFFF as expected p = BAD2; //p == 0 ?????? } ///////////////////////////////////////////////////// Cheers, Andy Leiper IET Ltd Quote Link to post Share on other sites
Pavel 0 Posted February 7, 2011 Report Share Posted February 7, 2011 Fixed. Fix will be available in 7.02. Thanks for reporting. 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.