From cdb06c4c44ec4041935debcc77470c6e71ded84f Mon Sep 17 00:00:00 2001 From: mpabi Date: Sat, 25 May 2024 17:08:02 +0000 Subject: [PATCH] Prefer const and inline to #define. --- cpp/_rvmain.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cpp/_rvmain.cpp b/cpp/_rvmain.cpp index 08d91db..9f05cc6 100644 --- a/cpp/_rvmain.cpp +++ b/cpp/_rvmain.cpp @@ -12,14 +12,19 @@ void strcpy(char *s, char *t) while (*s++ = *t++); } -class GamePlayer { + +// Effective C++ by Scott Meyers +// page. 6 +// Item 1: Prefer const and inline to #define. +// +class NewDefine{ private: + static const int ALLOCSIZE= 10000; - static const int NUM_TURNS = 5; - int scores[NUM_TURNS]; +}; -} c; +const int NewDefine::ALLOCSIZE; #define ALLOCSIZE 10000