Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
why adding #define contsants for initializing a const is breaking rule 10.3 ?
#5
Hi
you just have to cast your data. 2 solutions:
Code_1:
Code:
// this constrains the use of the define
#define CONST1 ((uint16_t)556U)
uint16_t const MY_var1 = CONST1;

Code_2:
Code:
#define CONST1 556U
uint16_t const MY_var1 = (uint16_t) CONST1;
<t></t>


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)