Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Definition of "constant expression"
#4
Yes, the difference between integer constant expressions and constant expressions does seem to need a bit more exploration.

I think I was wrong when I wrote in my previous reply that that rule wouldn't apply to "c+1u" because the expression does satisfy the constraints for a constant expression regardless of whether c has a const-qualified type or not. There's no mention of objects in the constraints, unless I've missed it somehow. And clearly constant expressions must be permitted to contain the names of objects in order to allow "address constant expressions" as in:
Code:
const int *p = &i;
In which case does this rule really apply to all expressions that satisfy the constraints for a constant expression? Or is it intended to apply to those that satisfy the semantics for an integer constant expression, as well as the constant expression constraints?
<t></t>
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)