Variables optimized out with g++ and the -Og option
问题 When I compile my C++ program with g++ using the -Og option I see variables that are <optimized out> , and also the current line sometimes skips around. Is this behaviour expected at this optimization level, or do I have some problem? The man page of gcc says: -Og Optimize debugging experience. -Og enables optimizations that do not interfere with debugging. It should be the optimization level of choice for the standard edit-compile-debug cycle, offering a reasonable level of optimization