Is it possible to define your own Boolean types? - 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.10 The essential type model (https://forum.misra.org.uk/forumdisplay.php?fid=165) +---- Thread: Is it possible to define your own Boolean types? (/showthread.php?tid=1545) |
Is it possible to define your own Boolean types? - andrea96b1 - 06-07-2020 Hello, I want to know if it is possible to define a Boolean type and do not use the one defined in the stdbool.h. Can I define Boolean like this: Code: typedef uint8_t boolean; Code: #define TRUE 0x1 Code: #define FALSE 0x0 Sorry in advance If the question is not too clear and If I made some mistake. Re: Is it possible to define your own Boolean types? - misra-c - 05-08-2020 The MISRA-C working group recommends the use of the stdbool.h version of bool where available. However Appendix D.6 on Boolean constants says: " Tools may also provide additional ways of identifying essential Boolean types." It is therefore possible to define a boolean type as you have done. The MISRA C:2012 rules on essentially boolean types will then apply. |