Posts: 29
Threads: 3
Joined: Dec 2008
Reputation:
0
I don't see why you could possibly claim that the defined preprocessing operator is not "effectively Boolean"
ISO 9899:1990 clause 6.8.1 says it return either 0 or 1.
Granted it wil be a long and not an int that a true (or at least as true as you can get in C) Boolean would be.
I don't know hat values you expect Booleans to take!
So I think a strong case can be made.
<t></t>
Posts: 87
Threads: 68
Joined: Nov 2004
Reputation:
0
Exactly, William. :-) I merely was looking for confirmation from MISRA the absence of 'defined' in the definition of "Boolean Expressions" was, perhaps, an oversight.
Posts: 632
Threads: 18
Joined: Jan 2006
Reputation:
1
Rule 12.6 is not intended to prohibit the use of the '!' operator in this way. It can indeed be argued that the 'defined' operator yields an effectively Boolean expression and this is a fair justification for permitting '!' to be applied to the result of 'defined'.
Posted by and on behalf of the MISRA C Working Group