Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Conversions outside of the essential type categories
#1
Hello,

With respect to the essential type rules, do conversions to types that are outside the essential type categories count as violations of the rules? For example:
Code:
#include
char buf[80];
char *p = buf;
uintptr_t p_plus_one;
void foo(void);
void foo(void) {
    // This next statement violates R11.4.  But does
    // it violate R10.8?  As a pointer type, p+1 does not
    // have a clear essential type category.
    p_plus_one = (uintptr_t)(p+1);
}
On the one hand, the spirit of the rule seems like it should prohibit such things. On the other hand, TC1 amends rule 10.1 to describe how a pointer type may not be used as an operand of a logical operator.

Thank you for your time.

-Greg
<t></t>
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)