attribute 扩展
生活随笔
收集整理的這篇文章主要介紹了
attribute 扩展
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
今天參考json-c的源碼
讀到一個關于attribute 擴展
static void json_object_init(void) __attribute__ ((constructor)); static void json_object_fini(void) __attribute__ ((destructor));google到含義如下
void main_enter() __attribute__((constructor));//main_enter函數在進入main函數前調用
void main_exit() __attribute__((destructor));//main_exit函數在main函數返回后調用
?
在main之后調用,可以用
at_exit(); 注冊函數,但函數聲明類型固定了。
在main之前調用,可以利用全局變量來做。
這個擴展好,今后好好用到。
轉載于:https://www.cnblogs.com/westfly/archive/2012/06/07/2540500.html
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的attribute 扩展的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java任务poer_java-Powe
- 下一篇: 算法之美