naderus
Member level 1
codevision sizeof
Hi,
I want to write something like this in IAR or Codevision my code:
#define A sizeof(long)
#define B 100 - A
#if (A < C)
#error no
#endif
but when i compile it with IAR get this error:
Error[Pe059]: function call is not allowed in a constant expression
and when compile it with codevision get this error:
Warning: undefined symbol 'sizeof' , assumed zero
Error: missing ')'
( I get this error on line "#if (A < C)")
but when I write this code:
#define A sizeof(long)
#define B 100 - A
the IAR and codevision both are compiled without any error.
I also test it with MPLAB 7 that is for PIC and don't get any problem.
Can anyone tell me what is it wrong?It's really important for me that
write my code like it.
Hi,
I want to write something like this in IAR or Codevision my code:
#define A sizeof(long)
#define B 100 - A
#if (A < C)
#error no
#endif
but when i compile it with IAR get this error:
Error[Pe059]: function call is not allowed in a constant expression
and when compile it with codevision get this error:
Warning: undefined symbol 'sizeof' , assumed zero
Error: missing ')'
( I get this error on line "#if (A < C)")
but when I write this code:
#define A sizeof(long)
#define B 100 - A
the IAR and codevision both are compiled without any error.
I also test it with MPLAB 7 that is for PIC and don't get any problem.
Can anyone tell me what is it wrong?It's really important for me that
write my code like it.