Some of us in my company are arguing about it. Given a source code and a compiler (compiled with same flags/switches) is it possible that the compiler will create binaries that will have different behaviors in different OSes?
Concretely, we’ve a C# project that must be run in Windows XP and Windows 7, both 32 bit. The compiler is VS 2008. There is a solution file (*.sln) that contains all necessary files, assemblies, projects etc that we use to build the software.
Is it possible that if the code (the same solution file) is compiled in VS 2008 (with same flags/switches, as it is the same solution file) in XP will produce a binary which will have behavioral difference than the compiled binary in Windows 7?
By behavioral difference I mean, in a given situation…
- The XP build will run as expected in XP
- The Win 7 build will run as expected in Win 7
- The XP build may cause a bug (may be a crash, or some unexpected behavior) in Win 7 and vice versa
The project is too huge to come up with a little test project. I want to know what are the cases (if any) when the above is true.
Given identical installations of VS2008, including service packs, and given identical frameworks, including service packs, on the test machines, the answer is no.
However, this does not mean that there are not tasks that the application performs that will behave differently on the different operating systems.
You must also consider that the operating system’s different responses to the application (firewall, DEP, UAC, etc) could expose flaws in the application on one operating system that are not present on another.
And then there is the unmanaged code issue, which is another topic altogether. And, while we’re at it, native OS calls from your app could cause instability.
But none of this is due to the compiler given the constraints in the opening sentence.