Prefer const and inline to #define.
This commit is contained in:
parent
ea8abde781
commit
cdb06c4c44
|
@ -12,14 +12,19 @@ void strcpy(char *s, char *t)
|
||||||
while (*s++ = *t++);
|
while (*s++ = *t++);
|
||||||
}
|
}
|
||||||
|
|
||||||
class GamePlayer {
|
|
||||||
|
// Effective C++ by Scott Meyers
|
||||||
|
// page. 6
|
||||||
|
// Item 1: Prefer const and inline to #define.
|
||||||
|
//
|
||||||
|
class NewDefine{
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static const int ALLOCSIZE= 10000;
|
||||||
|
|
||||||
static const int NUM_TURNS = 5;
|
};
|
||||||
int scores[NUM_TURNS];
|
|
||||||
|
|
||||||
} c;
|
const int NewDefine::ALLOCSIZE;
|
||||||
|
|
||||||
#define ALLOCSIZE 10000
|
#define ALLOCSIZE 10000
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue