dept2 / CuteLogger

Logger: simple, convinient and thread safe logger for Qt-based C++ apps
GNU Lesser General Public License v2.1
145 stars 97 forks source link

Should add "private:" keyword before Q_DISABLE_COPY #22

Closed examyes closed 8 years ago

examyes commented 8 years ago

this is how Q_DISABLE_COPY being declared in qglobal.h:

/*
   Some classes do not permit copies to be made of an object. These
   classes contains a private copy constructor and assignment
   operator to disable copying (the compiler gives an error message).
*/
#define Q_DISABLE_COPY(Class) \
    Class(const Class &); \
    Class &operator=(const Class &);
cyberbobs commented 8 years ago

Please note that the every mentioned Q_DISABLE_COPY macro is called at the very beginning of the declaration of classes.

class CUTELOGGERSHARED_EXPORT Logger
{
  Q_DISABLE_COPY(Logger)

  public:

Every function declaration in a class without an access specifier before it is considered private by default in C++. So, actually, the current implementation is perfectly fine and does exactly what it meant to do. Thanks for the suggestion though.