Am 01.08.2014 12:03, schrieb "Marc Schütz" <schue...@gmx.net>":

A compiler is a program that turns code in one programming language to
equivalent machine code, according to a language specification. There
are obviously many different equivalent machine code programs
corresponding to any sufficiently complex higher-level program.
Classifying them into optimized and unoptimized ones is rather
arbitrary. The same goes for safe vs. unsafe optimizations.

To achieve what you want, the compiler would have to ignore the actual
language specification and use a different one that is tweaked according
to your criteria. I don't think this is desirable. If the official
language specification has parts that can lead to the errors you want to
avoid, then it's not the compiler's fault, and therefore the compiler
should not be changed to workaround it. Instead, deficiencies in the
specification should be fixed there.

I'd prefer language specifications *not* to include such parts.
C wouldn't be any worse without the "you can eliminate writes to code that's not read afterwards" part, for example.

So I wish D could resist adding such "dangerous"/unexpected things to the standard and only allow such optimizations in an "unsafe" optimization mode.

Cheers,
Daniel

Reply via email to