MISRA Discussion Forums
Dir 4.6 Does "plain char" need to be typedeffed - 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: 7.4 Code design (https://forum.misra.org.uk/forumdisplay.php?fid=181)
+---- Thread: Dir 4.6 Does "plain char" need to be typedeffed (/showthread.php?tid=1011)



Dir 4.6 Does "plain char" need to be typedeffed - misra-c - 18-12-2013

Does Directive 4.6 cover the use of the plain “char” type for the storage and handling of character values?
For example
Code:
const char * string = “some data”;  /* compliant or not ? */



Re: Dir 4.6 Does "plain char" need to be typedeffed - misra-c - 18-12-2013

The numerical types of “char” are “signed char” and “unsigned char”. Plain ”char” is not considered a numerical type by this directive.

It is fine to use the basic type of “char” for handling character values. This is referred to as the “essentially character” type in Appendix D. Likewise the C99 _Bool type is not a numerical type for the purposes of this directive.

It should be noted that "Exception 4" in the guidelines should not be listed as an exception but as a note as it refers to plain “char”.