GNU GCC 擴展屬性

http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.htmlhtml

constructoride

destructorspa

constructor (priority)code

destructor (priority)htm

The constructor attribute causes the function to be called automatically before execution enters main (). Similarly, the destructor attribute causes the function to be called automatically after main () completes or exit () is called. Functions with these attributes are useful for initializing data that is used implicitly during the execution of the program.ip

You may provide an optional integer priority to control the order in which constructor and destructor functions are run. A constructor with a smaller priority number runs before a constructor with a larger priority number; the opposite relationship holds for destructors. So, if you have a constructor that allocates a resource and a destructor that deallocates the same resource, both functions typically have the same priority. The priorities for constructor and destructor functions are the same as those specified for namespace-scope C++ objects (see C++ Attributes).ci

These attributes are not currently implemented for Objective-C.get

相關文章
相關標籤/搜索