rule 13.2: are const volatile variables volatile or not? - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4) +--- Forum: MISRA C:2012 and MISRA C:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=21) +---- Forum: 8.13 Side effects (https://forum.misra.org.uk/forumdisplay.php?fid=168) +---- Thread: rule 13.2: are const volatile variables volatile or not? (/showthread.php?tid=1368) |
rule 13.2: are const volatile variables volatile or not? - ggoulas - 22-09-2017 Hi, Quick question about rule 13.2: the following variable: const volatile uint8_t myvar = 0; should it be considered as volatile or non-volatile in the context of rule 13.2 ? thank you. Re: rule 13.2: are const volatile variables volatile or not? - misra-c - 24-10-2017 The above initialization is compliant with rule 13.2, but it is assumed that the question refers to the use of "myvar" in other expressions. "myvar" should then be considered as having a volatile-qualified type. For example: Code: const volatile uint8_t myvar = 0; |