On 2/3/2011 3:58 AM, David Brown wrote:
On 03/02/2011 10:56, Drasko DRASKOVIC wrote:
On Thu, Feb 3, 2011 at 10:42 AM, David Brown<david@xxxxxxxxxxxxxxx>
wrote:
My understanding is that "register" is ignored at -O1 and above,
which would
seem to match your experience.
You wanted to say "-O1 and below", right ?
No, "register" is ignored at -O1 and above. When the optimiser is
enabled, /it/ decides whether data should go in a register, or has to
go on the stack, or can be eliminated entirely. It is only at -O0
that the compiler puts everything on the stack by default, and puts
"register" data in registers. That's why the "register" keyword has
been considered redundant for many years - the compiler almost always
does a much better job than any human at deciding what data to put in
registers.
Let us not forget that a human wrote the compiler. Ultimately, it is a human who makes these decisions. At least, I hope so. :-)
A little off topic here, but it bugs me when "customer service" tells me there was a "computer error." No, there was a programming error, which was made by a human.
--Bob