[TYPES] Declarative vs imperative

Uday S Reddy u.s.reddy at cs.bham.ac.uk
Tue Apr 23 14:32:38 EDT 2013


Mark Janssen writes:

> I well aware of compiler flags and was not implying at all that they
> don't do anything.  What I was saying is that the compilers output is
> deterministic.  If you use the same flags and the same source, you
> will get the same output -- unless you're suggesting some *magic
> happens here* event.

Since we seem to have given up talking about languages and want to talk
about compilers instead, here is a point.

There is no law that requires that a compiler's output should be
deterministic.  The compiler is quite within its rights to produce a
different object code program during every compilation, as long as it
accepts all legal programs and preserves their meaning as per the language
definition.

In fact, at least in one case, I would welcome a compiler that does that.
In the C standard, the order of evaluation of arguments in function calls is
unspecified.  However, if I were stupid enough to depend on a particular
evaluation order that my compiler chooses deterministically, I would have
hidden bugs in my programs that I wouldn't be able to notice.  If I paid
good money for a C compiler, I would definitely demand that it should have
an option to randomize the evaluation order of arguments.

Cheers,
Uday


More information about the Types-list mailing list