MISRA Discussion Forums
Essential Type of parenthesised expression - 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: Essential Type of parenthesised expression (/showthread.php?tid=1047)



Essential Type of parenthesised expression - misra-c - 11-04-2014

What is the essential type of a parenthesised expression?

For example: ( 3 U ) has a standard type of "unsigned int". Is the essential type of the parenthesised expression "unsigned int" or "unsigned char"


Re: Essential Type of parenthesised expression - misra-c - 11-04-2014

This questions relates to ( expression ), which is one of the options of primary-expression. According to the C standard ( C90 6.1.5, C99 6.4.6) "( )" is an operator. It should therefore be covered by Appendix D.7 on essential types.

The absence of ( ) was an oversight and the documentation should include
Quote:Parenthesis ( ( ) )
The essential type of the result is the essential type of the operand.

(3u) is intended to have an essential type of "unsigned char".