- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Any suggestions?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you mean warning #2023 not #2022, right? The one that looks like:
sptxl8-483> cat t.cpp
struct C {
int i;
C(): j(5), i(3) {;}
int j;
};
sptxl8-484> icpc -Weffc++ -c t.cpp
t.cpp(4): warning #2023: Effective C++ Item 13 initialize fields in order they are declared
C(): j(5), i(3) {;}
^
Anyway since we are not going to make users who don't care about the effective C++ checking pay the price for doing thesemanticanalysis you need to turn on -Weffc++ to execute the code that does the checking.
Once you have added the -Weffc++ option your only choice is to individually disable the warningsyou don't care about (using -diag-disable:number). It looks like there are a total of about 40 separate warnings so it might be painful to disable them all individually but that is your only choice. The effective C++ warningsare in the range from warning 2012 up to and including warning number 2049.
Judy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What about
#pragma warning( enable : 2023 )
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can't just enable the warning without also using the -Weffc++ switch, because the warning will only be reached if the effective C++ code checking is turned on. Without the -Weffc++ optionwe don't evenexecute the sections of code that would detect the warning. And once you turn on the -Weffc++ switch then by default you get all the effective c++ warnings.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page