Calling other objects methods inside a constructor
If I have this code
Code:
File 1:
typedef class c_Semaphore
{
public :
c_Semaphore()
{
if (sem_init(&sem, 0,0)) Log.Error("Error in semaphore init (constructor)");
}
~c_Semaphore() { sem_destroy(&sem); }
sem_t sem;
} Type_Semaphore;
Type_Semaphore Sem;
File 2 :
typedef class c_Log
{
public :
...
void Error(const char * ch) {..}
} Type_Log;
Type_Log Log;
Would you suppose that the compiler+linker is sufficiently fine to call c_Log constructor for object Log and after the constructor for Sem or , as they are in different modules, the compiler+linker gives errors or does not garauntee the correct order in constructor callings?
thank you