3 ms·
The compiler is deterministic - for the same inputs, you'll get the same outputs. Unless you've got memory corruption in it.
by WalterBright 3y ago
The compiler is deterministic - for the same inputs, you'll get the same outputs. Unless you've got memory corruption in it.
- burjui 3y agoOr unless you iterate over randomized hashtables to produce some output, e.g. function sections in an executable. Though that doesn't change the semantics and is basically rearranging coins in your pocket.
- eru 3y agoMany optimizers (and other algorithms used in compilers) can benefit from some random bits. Though, of course, in practice you can use pseudo-random bits and fix the seed.
- WalterBright 3y agoHaving a compiler produce different code for the same source is a recipe for "I can't reproduce your bug and can't fix it".