Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Suppress 'Member was not initialized in this constructor' warning(Code Analysis)
Suppress 'Member was not initialized in this constructor' warning [message #1128293] Mon, 07 October 2013 14:46 Go to next message
Krzysztof Czaiński is currently offline Krzysztof Czaiński
Messages: 4
Registered: March 2013
Junior Member
Hi,

Is it possible to suppress the Code Analysis warning: "Member 'x' was not initialized in this constructor". I know I can turn this type of warning off, but I generally find it useful. I would only like to suppress it for one particular constructor.

The "No break at end of case" warning, for example, can by suppressed by adding a comment:
// no break

That's exactly the kind of solution I'm looking for, since I want to comment, that this variable is intentionally left uninitialized, anyway.

Regards,
Kris
Re: Suppress 'Member was not initialized in this constructor' warning [message #1129116 is a reply to message #1128293] Tue, 08 October 2013 09:54 Go to previous messageGo to next message
Axel Mueller is currently offline Axel Mueller
Messages: 1963
Registered: July 2009
Senior Member
There is always the possibility to exclude certain resources from this check.
Preferences->C/C++->Code Analysis
Select "Class members should be properly initialized" and then click button "Customize..". In the scope tab you can exclude certain resources.


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Suppress 'Member was not initialized in this constructor' warning [message #1129124 is a reply to message #1129116] Tue, 08 October 2013 10:04 Go to previous messageGo to next message
Krzysztof Czaiński is currently offline Krzysztof Czaiński
Messages: 4
Registered: March 2013
Junior Member
Axel Mueller wrote on Tue, 08 October 2013 05:54
There is always the possibility to exclude certain resources from this check.
Preferences->C/C++->Code Analysis
Select "Class members should be properly initialized" and then click button "Customize..". In the scope tab you can exclude certain resources.


Thanks for the quick response, but like I said,
Quote:
I know I can turn this type of warning off, but I generally find it useful. I would only like to suppress it for one particular constructor.


This warning has reminded me to initialize members many times in other places. I wish there was a suppressing comment for this or something Wink

Thanks,
Kris
Re: Suppress 'Member was not initialized in this constructor' warning [message #1130290 is a reply to message #1129124] Wed, 09 October 2013 11:56 Go to previous message
Axel Mueller is currently offline Axel Mueller
Messages: 1963
Registered: July 2009
Senior Member
Krzysztof Czaiński wrote on Tue, 08 October 2013 12:04
This warning has reminded me to initialize members many times in other places. I wish there was a suppressing comment for this or something

Then you should open a bugzilla request.


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Previous Topic:Why this SWT Handler error?
Next Topic:Generated resource conflict
Goto Forum:
  


Current Time: Tue Oct 21 08:44:57 GMT 2014

Powered by FUDForum. Page generated in 0.01805 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software