TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
C++ Coding Standard
Search

Rule:  POR#036

Synopsis:If an object is created using a default constructor, then don't use parenthesis in the declaration
Language:C++
Severity Level:3
Category:Portability


Description:

Some compilers, like the Visual Studio compiler, don't care, but a declaration with parenthesis on the stack is not ANSI C++.

// Incorrect!!
void
MyClass::F(
    int x)
{
    OtherClass stackObj();
    ...
};
// Correct!!
void
MyClass::F(
    int x)
{
    OtherClass stackObj;
    ...
};