Search code examples
c++syntaxfunction-callsfunction-declaration

How to distinguishe declaration and use of a function?


I have the following structure in the code:

while (x > 0) {
     something;
     aaa::bbb::ccc some_name(
        x,
        y
     );
}

I cannot understand what aaa::bbb::ccc some_name(. If it is a call of function, why do we need to specify its time aaa::bbb::ccc. If it is a declaration of a function, why it is done in while loop and why types of the arguments are not specified?


Solution

  • You don't specify the return type in function calls, so this cannot possibly be a function call.

    As Pubby points out, it is very likely an object definition. You define an object called some_name of type aaa::bbb::ccc and pass x and y to the constructor.