g++ -O1 a.cpp -O2 b.cpp How cpp file optimized?

Viewed 12

I attended a exam, one question is:

g++ -O1 a.cpp -O2 b.cpp

How the a.cpp and b.cpp optimized?
A.O1 on a.cpp and O2 on b.cpp
B.O1 on a.cpp and b.cpp
C.O2 on a.cpp and b.cpp

The problem seems silly and may be useless in practice...

Is there any standard discuss this problem?

By the way, is there any way that we can obtain compile options based on object files?

0 Answers
Related