We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi all, I defined a macro as
#define min(a,b) (((a) < (b)) ? (a) : (b))
xfr_cnt = min(to_xfer, secsize - boff);
xfr_cnt= ((to_xfer < (secsize - boff)) ? (to_xfer) : (secsize - boff));
I tried the code snippets, that you have posted with the C51 V7.20. The macro is expanded like yours and the object file is generated correctly. There must be anything special that you do in your code.
#define min(a,b) (((a) < (b)) ? (a) : (b)) void test (void) { int xfr_cnt; int to_xfer = 1; int secsize = 4; int boff = 2; xfr_cnt = min(to_xfer, secsize-boff); }