Skip to main content
Code Review

Return to Answer

Commonmark migration
Source Link

Include your own headers before standard headers

##Include your own headers before standard headers I'dI'd write:

#include "PunctFacet.h"
#include <fstream>
#include <iterator>
#include <string>
#include <set>
#include <numeric>

That way, if you accidentally forget a necessary definition in your own header (by virtue of an earlier include happening to provide it), you increase your chances of discovering it at an early stage.

Avoid magic constants

##Avoid magic constants WhereWhere does that 256 come from? If it's supposed to be equal to base::table_size, then just use the constant, to be consistent with the base class.

Review visibility of types

##Review visibility of types II don't see a need to make the base type public - it seems that this is provided for implementation convenience only (and it tends to get confusing when you have a hierarchy where many, but not all, classes provide such a member).

##Spell-check your comments

Spell-check your comments

// read all the names in a set (it's sorted)
 ^^^^

(Okay, I'm over-doing it now!)

##Include your own headers before standard headers I'd write:

#include "PunctFacet.h"
#include <fstream>
#include <iterator>
#include <string>
#include <set>
#include <numeric>

That way, if you accidentally forget a necessary definition in your own header (by virtue of an earlier include happening to provide it), you increase your chances of discovering it at an early stage.

##Avoid magic constants Where does that 256 come from? If it's supposed to be equal to base::table_size, then just use the constant, to be consistent with the base class.

##Review visibility of types I don't see a need to make the base type public - it seems that this is provided for implementation convenience only (and it tends to get confusing when you have a hierarchy where many, but not all, classes provide such a member).

##Spell-check your comments

// read all the names in a set (it's sorted)
 ^^^^

(Okay, I'm over-doing it now!)

Include your own headers before standard headers

I'd write:

#include "PunctFacet.h"
#include <fstream>
#include <iterator>
#include <string>
#include <set>
#include <numeric>

That way, if you accidentally forget a necessary definition in your own header (by virtue of an earlier include happening to provide it), you increase your chances of discovering it at an early stage.

Avoid magic constants

Where does that 256 come from? If it's supposed to be equal to base::table_size, then just use the constant, to be consistent with the base class.

Review visibility of types

I don't see a need to make the base type public - it seems that this is provided for implementation convenience only (and it tends to get confusing when you have a hierarchy where many, but not all, classes provide such a member).

Spell-check your comments

// read all the names in a set (it's sorted)
 ^^^^

(Okay, I'm over-doing it now!)

Source Link
Toby Speight
  • 87.9k
  • 14
  • 104
  • 325

##Include your own headers before standard headers I'd write:

#include "PunctFacet.h"
#include <fstream>
#include <iterator>
#include <string>
#include <set>
#include <numeric>

That way, if you accidentally forget a necessary definition in your own header (by virtue of an earlier include happening to provide it), you increase your chances of discovering it at an early stage.

##Avoid magic constants Where does that 256 come from? If it's supposed to be equal to base::table_size, then just use the constant, to be consistent with the base class.

##Review visibility of types I don't see a need to make the base type public - it seems that this is provided for implementation convenience only (and it tends to get confusing when you have a hierarchy where many, but not all, classes provide such a member).

##Spell-check your comments

// read all the names in a set (it's sorted)
 ^^^^

(Okay, I'm over-doing it now!)

lang-cpp

AltStyle によって変換されたページ (->オリジナル) /