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.
I was reading on misra website that for assigning 0 to unsigned variable, 'u' must be suffixed.
For example:
uint8_t my_cnt = 0U;
1. Does that even on declaring array I should use this.Like
uint8_t my_arr[10U];
2. Also while using switch cases like:
void func(uint8_t no) { switch(no) { case 1U: break; case 2U: break; } }
If yes then what if variable passed to switch is of int8_t type. In above example if
int8_t no;
#define signed_number 0xFF #define unsigned_number 0xFFU int8_t var_s; uint8_t var_u; int main (void) { var_s = signed_number; var_s = unsigned_number; var_u = signed_number; var_u = unsigned_number; while (1); }
Now think.