【发布时间】:2013-01-17 02:03:56
【问题描述】:
可能重复:
Can you print anything in C++, before entering into the main function?
在调用 int main() 之前是否有可能运行任何其他指令?
int main(){cout<<"a";}
在 main() 调用之前,调用 cout
【问题讨论】:
-
bool f() { cout << "before main"; return true; } bool dummy = f(); int main(){ cout<<"main"; } -
当然有,google一下。
-
是的。其实你甚至可以在
main之前退出程序:) -
我觉得我一直在关注这一点,直到 “this #define thing”。那么……嗯?
-
@chris,你的意思是当你的 main 代码运行时进程终止了?对我来说听起来像是一个错误:p