When is the constructor called?

This is a discussion on When is the constructor called? within the C++ Programming forums, part of the General Programming Boards category; ... and destructor.
If I have a class like this:
Code:
class ErrorLog
{
public:
ErrorLog();
~ErrorLog();
static bool OpenLogs( ...

He probably wants to know if a call to one of the static functions will result in the call of the constructor and destructor. And the answer is no. But if you are going to make all functions of a class static why not use a namespace instead?

A namespace can't exactly have private variables, so a class with only static methods isn't too bad. (Personally I'd go for a global instance and thus not prevent having multiple logs.) With namespaces, you'd have to use things like subnamespaces in order to hide implementation - and even then it's very little hiding.

Some differences between the two cases (I hesitate to call them advantages, as the choice is a tradeoff) include;

1) The stream in the static version must (according to the standard) be initialised at or before the first call of the static member function. In practice, with many compilers, this will happen before main() is called, and means that the logger is initialised even if it is never used. The stream in the singleton version will never be initialised before first usage of the logging functions, meaning that the stream will never be initialised if the program does no logging.

2) The initialisation for the static version must generally be at compile time. The singleton version, with only minor tweaks, can be initialised using runtime data. For example, a name of the log file could be specified on the command line, and used to initialise the stream.