/Qeffc++ uninitialized member

/Qeffc++ uninitialized member

/Qeffc++ on windows doesnt warn about an uninitialized member.

class Test {

public:

Test() {}

int * i_;

int ii_;

};

In gcc with -Weffc++ it gives this warning:

Test.cpp:9: warning: `Nada::i_' should be initialized in the member initialization list

Test.cpp:9: warning: `Nada::ii_' should be initialized in the member initialization list

Help anyone?

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

With a current version of icpc, I see
allday.cpp(6): warning #2021: Effective C++ Item 11 declare a copy constructor and assignment operator for Test
};
^

allday.cpp(3): warning #2022: Effective C++ Item 12 field member "Test::i_" not initialized (preferable to assignment in constructors)
Test() {}
^

allday.cpp(3): warning #2022: Effective C++ Item 12 field member "Test::ii_" not initialized (preferable to assignment in constructors)
Test() {}
^
As you point out, the 32-bit Windows compiler doesn't issue any diagnostics. I filed this on premier.intel.com, issue 516834, in case the window is still open to fix this for the next release.

Best Reply

Quoting - alldaycpp
/Qeffc++ on windows doesnt warn about an uninitialized member.

class Test {
public:
Test() {}
int * i_;
int ii_;
};

In gcc with -Weffc++ it gives this warning:

Test.cpp:9: warning: `Nada::i_' should be initialized in the member initialization list
Test.cpp:9: warning: `Nada::ii_' should be initialized in the member initialization list

Help anyone?

You can use Intel C++ compiler 11.0.074.

Leave a Comment

Please sign in to add a comment. Not a member? Join today