Essential Type of parenthesised expression

Moderators: misra-c, david ward

Post Reply
misra-c
Posts: 566
Joined: Thu Jan 05, 2006 1:11 pm

Essential Type of parenthesised expression

Post by misra-c » Fri Apr 11, 2014 8:47 am

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"
---
Posted by and on behalf of
the MISRA C Working Group

misra-c
Posts: 566
Joined: Thu Jan 05, 2006 1:11 pm

Re: Essential Type of parenthesised expression

Post by misra-c » Fri Apr 11, 2014 8:50 am

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
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".
---
Posted by and on behalf of
the MISRA C Working Group

Post Reply

Return to “8.10 The essential type model”