Are parentheses used for grouping considered an operator?

In C, parentheses are used to create more functions, such as function calls and type casting.

However, they are also used to group many subexpressions to change the order-evalutation of operators.

My doubt is that when used as grouping operators, they are treated as an operator?

Many say they are, many say no ...

+4
source share
3 answers

6.5 Chapter of Expressions (N1570), paragraph 3

The grouping of operators and operands is denoted by syntax. 85)

has the following note:

85) , , . , , , + (6.5.6), , 6.5.1 - 6.5.6. (6.5.4) (6.5.3) , : () (6.5.1), [] (6.5.2.1), () (6.5.2.2) ?: (6.5.15).

, , C- .

+3

, - -, , . , .

- , * , .

* , - . , , . , .

+2

, .

, (.. , , ).

( ):

C11 1 6.4.6 2

- , . (, , , ), ( 3). - , .

:

C11 6.5.1/5

. . lvalue, , void, unparenthesized , , lvalue, void.

void . , , (void expr):

((void) 5); // here, no side effects are produced

-, (), . ( ) , .


1) N1570.

2) The corresponding quote is essentially the same as in C90, although it was located in Section 6.1.5 “Operators”, which is no longer present.

3) This phrase was added to C99. I believe that his goal was to reflect the new operator _Pragma.

+1
source

Source: https://habr.com/ru/post/1544714/


All Articles