반응형
C++로 코드를 짤 때,
static class의 인스턴스를 선언하면 해당 클래스의 constructor는 main보다 먼저 불린다.
반대로 destructor는 main이 종료된 이후에 불릴 것이다.
gcc에서는 이와 유사한 기능을 할 수 있도록 __attribute__((constructor)) 와 __attribute__((destructor))를 제공하고 있다.
static class의 인스턴스를 선언하면 해당 클래스의 constructor는 main보다 먼저 불린다.
반대로 destructor는 main이 종료된 이후에 불릴 것이다.
gcc에서는 이와 유사한 기능을 할 수 있도록 __attribute__((constructor)) 와 __attribute__((destructor))를 제공하고 있다.
반응형