NeoHippo wrote:If code should be the same regardless of the compiler used, then either Builder.exe should be the same.
Yet, they are not.
Not regardless of the compiler. Regardless of the CPU.
Different compilers might transform the code differently. Heck, even the same compiler might do things differently depending on optimization settings. And all projects come with different "profiles" (usually at least debug vs. release).
But if you have:
- the same compiler
- the same project configuration and profile
- the same version of the libraries
- the same version of the source code
- different CPUs
the result should be exactly the same. On the other hand, you can bet you will have different results if you have:
- different compilers
- different project configurations and profiles
- different versions of the libraries
- different versions of the source code
- the exact same CPU
To go back on our simplistic example of the 2+2 program, it'll output a file containing 4 in all cases because it'll be what the CPU computed 2+2 to be, but it could be 4 padded with zeros (0004), 4 followed by a newline, 4 written as a floating point value (4.0), "four" written in English, IV in roman numerals, 0100b in binary, and so on. This depends on how the "compiler" was designed. It doesn't matter for the value of the outcome, but there's still room for differences.
[quote="NeoHippo"]If code should be the same regardless of the compiler used, then either Builder.exe should be the same.
Yet, they are not.[/quote]
Not regardless of the compiler. Regardless of the CPU.
Different compilers might transform the code differently. Heck, even the same compiler might do things differently depending on optimization settings. And all projects come with different "profiles" (usually at least debug vs. release).
But if you have:
- the same compiler
- the same project configuration and profile
- the same version of the libraries
- the same version of the source code
- different CPUs
the result should be exactly the same. On the other hand, you can bet you will have different results if you have:
- different compilers
- different project configurations and profiles
- different versions of the libraries
- different versions of the source code
- the exact same CPU
To go back on our simplistic example of the 2+2 program, it'll output a file containing 4 in all cases because it'll be what the CPU computed 2+2 to be, but it could be 4 padded with zeros (0004), 4 followed by a newline, 4 written as a floating point value (4.0), "four" written in English, IV in roman numerals, 0100b in binary, and so on. This depends on how the "compiler" was designed. It doesn't matter for the value of the outcome, but there's still room for differences.