-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
In server.hpp, there is a definition of MAX_SESSIONS
It is in global scope, any source or header file that includes this header will now have the definition of MAX_SESSIONS in their namespace, yet they will have nothing to do with it because it's an implementation detail of the server class
You should ditch the #define, and instead just declare it as a private member of the server class:
static contsexpr size_t kMaxSessions = 10
or
static const size_t kMaxSessions = 10
The advantage of this method:
- Can view the variable in a debugger
- Encapsulation: users outside of the class can no longer see this
Disadvantage is that some functions in server.cpp will not be able to access it because they're not all members of the server class, in this case you will have to add them as static functions
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
