Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 18.4, 10.1, and the "type" of pointer to object
#1
Within our development group, there has been some discussion as to whether or not the construction
Code:
void test(uint8_t * up)
{
    bool invalid = !up;
    ...
}
is valid with regard to the usage of '!' against a pointer. According to the 18.X rules, '!' is not disallowed for use on pointers, but the explanation of Rule 10.1 with regards to the appropriate essential type for use with '!' would indicate that, as a non-Boolean, its use on pointers should be disallowed.

Do pointers have an "essential type" under the essential type model and what is the correct interpretation in this case?
<t></t>


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)