This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: optimisation question
- From: Robert Dewar <dewar at adacore dot com>
- To: "Remy X.O. Martin" <vsxo at hotmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 31 Jan 2005 12:28:59 -0500
- Subject: Re: optimisation question
- References: <20050131152659.0dc92d6c@portia.local>
Remy X.O. Martin wrote:
As far as I remember, I have been taught (like 15 years ago) that writing
a=b=c can be better than a=c; b=c; because the compiler could more easily
use values in registers.
That's nonsense for any reasonable compiler. This is less like advice on
general programming than advice on getting around a bug or complete lack
of optimization competence on some particular compiler. I suppose if
you had a compiler so stupid as to load c twice in the second case, then
the advice would make sense.