For all behaviour that the standard defines, programs generated by all compilers must behave the same way.
For all behaviour that the standard leaves unspecified, compilers do not need to behave the same. The standard makes no guarantees about programs that violate the standard for example. The standard also leaves many details up to the implementation.
Also, compilers tend to not always comply to the standard in all cases and some compilers may not support same version of the standard as another.
Finally, some standard rules are found to be ambiguous, and different compilers may have chosen an opposite interpretation. These should be documented as defect reports.
.. seed ... rand function ...
The random sequence produced by rand
is implementation defined. Yes, the results can be different with different compilers.
C++11 introduced <random>
header. Of the random number generators defined there, default_random_engine
is the only one that has implementation defined behaviour.