MENU

【gcc拡張】c++でmain関数の前と後に関数を呼ぶ

gcc拡張により
関数の前に__attribute__(( constructor))を付けると最初に
関数の前に__attribute__(( destructor))を付けると最後に呼ばれます

__attribute__((constructor))
void constructor() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);
}

とかしておくと便利ですclangでは使えなかった気がします(調べてないです)