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));
hi, try to avoid any spaces when pass arguments to macro which uses formal parameters. Another way - use additional brackets for complex arguments. Regards, Oleg
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); }
Best send a report to Keil in that case.
No, it's a Windows XP error dialog box. I can continue, but seems the C file is not compiled anyway.
Did it give an error message?
It's okay if I write that as
xfr_cnt = min(to_xfer, (secsize - boff));
View all questions in Keil forum