views:

59

answers:

1

Turns out it is perfectly valid for a C++ compiler to emit different machine code when recompiling the same program with exactly the same compiler/environment/whatever settings. Which implies that the compiler optimizer can decide how "deep" to optimize depending on various factors, amount of available memory included.

Does anyone have any evidence of whether Visual C++ does perform different optimizations depending on amount of memory available?

+1  A: 

If you're asking "does MSVC emit different output when I run the compiler itself on a machine with 1Gb of RAM versus one with 4Gb of RAM?" the answer is it theoretically could, but in our experience it doesn't. We're very sensitive to small details of code generation in our app so we've tested MSVC's behavior under all kinds of different configurations ranging from 1Gb WinXP machines to 8Gb Win7 ones. So far as we can tell, MSVC allocates as much memory as it wants and simply crashes if it runs out.

Crashworks
Of course I'm asking about the second thing. The first one will not make any sense for commercial software that is used on some machine far far away from the developer's.
sharptooth
Sorry, I guess I'm too used to seeing rather peculiar questions on SO. I've removed the irrelevant part of my answer.
Crashworks