C ++: is it permissible to omit a parameter value in a function call?

When compiling VTK 7.0.0 from a source using GCC 6, I encountered the following build error:

error: expected primary expression before '(token

radioButton_Min-> setGeometry (QRect (10, 20, 17));

The code that was used to build with GCC 5, which comes bundled with a previous version of Fedora. I understand that this may be the mistake of the authors of the VTK, but given the fact that the code used to build there are two questions:

  • Is this code valid C ++?
  • Is this code valid for GCC and / or other compilers, given some free settings that are not standard? At the moment, my warnings and error settings are pretty tough.

Important change:

It just turned out that this code was generated using the Qt UIC (interface compiler), which creates C ++ code based on the .ui interface definition files. Probably the previous version of UIC handled this differently. But for me, the question still remains: could you bring this standard to make sure that it is illegal with C ++?

+4
source share
1 answer

5.2.2 function call

A function call is a postfix expression followed by parentheses containing a possibly empty comma-separated list of initializer-clauses that make up the function arguments.

, , " ". . initializer-clause.

An initializer-clause 8.5 Initializers :

initializer-clause:
    assignment-expression
    braced-init-list

, assignment-expression, braced-init-list.

A braced-init-list , , {:

braced-init-list:
   { initializer-list , opt }
   {}

. , , , assignment-expression - . :

assignment-expression:
    conditional-expression
    logical-or-expression assignment-operator initializer-clause
    throw-expression

conditional-expression :

conditional-expression:
  logical-or-expression
  logical-or-expression ? expression : assignment-expression

. logical-or-expression . , - - , .

assignment-operator: one of = *= /= %= += -= >>= <<=

assignment-expression . .

throw-expression:

throw-expression:
    throw assignment-expression opt

, 15 , : "- void". void. , .

, . , ++, .

+3

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


All Articles