On Fri, 15 Mar 2013 11:43:16 -0400, Shao Miller wrote:
> Three quick questions (relative to N1570):
>
> 1. Are () an operator in the context of primary-expression: ( expression
> ) ?
>
> I'd answer "not really," but 6.5p1 seems to partition an expression into
> operators, operands, object/function designator, side-effect-causer, or
> combination. Then again, 42, on its own, wouldn't fit nicely into
> these, either.
No, they are punctuators, but not an operator because they don't have any
effect other than directing the parsing of the text.
>
> 2. Is _Generic an operator?
>
> I'd answer "not really," but same "concern" as above.
It is not referred to in the standard as being an operator, but if I
would have to describe it, I would describe it as one.
>
> 3. Do the () of #1 maintain unmentioned properties of the contained
> expression for the resulting primary-expression, such as "null pointer
> constant"?
Yes. A parenthesized expression can be part of an integer constant
expression as long as the other requirements are also met.
A null pointer constant is defined as being an integer constant
expression with the value 0 (or such cast to the type void*) and the
added parentheses do not affect the constant expression part of that.
>
> I'd answer "yes," but I'm not sure why, since it's not exactly covered
> by 6.5.1p5.
It is covered by combining 6.3.2.3p3 and 6.6.
>
> These questions prompted by a discussion (in another C-devoted forum)
> about:
>
> (void *) (void *) 0 /* Not an NPC */
> &*(void *) 0 /* Not an NPC */
> (((((void *) 0)))) /* NPC */
That last one is tricky and can probably be argued both ways.
I would consider a compiler that doesn't treat it as an NPC as being
particularly prickly, and it would be lowering that compilers QoI for me.
>
> --
> - Shao Miller
Bart v Ingen Schenau