Re: An article I alluded to

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks, Ian, Jeff, and company.  I'm always happy to hear from experts,
espcially because I program rarely in C.  I'll learn a lot on this list.

Bill

Ian Lance Taylor writes:
 
That article is very specific to DSPs.  I've seen DSPs in which there
is a limited range of memory, so that a load can be done from an
arbitrary memory address in a single instruction, and there is alsono
register offset memory addressing.  Under those conditions, it is
indeed more efficient to use a static variable than to use an
automatic variable.

However, any ordinary processor has register offset memory addressing,
and on most RISC processors you can not load from an arbitrary memory
address in a single instruction (although you can on x86).  So in
these normal conditions, automatic variables will be faster.
 
The article is wrong to suggest using the "register" declaration, as
it is universally ignored by optimizing compilers.  Similarly with the
advice about reusing local variables.

I didn't see any other obvious errors.

Ian
_______________________________________________________________
"Pro-choice?"  Then click here.
http://cathinsight.com/morality/saying.htm

"Men must look for the peace of Christ in the Kingdom of Christ... When
once men recognize, both in private and in public life, that Christ is
King, society will at last receive the great blessings of real liberty,
well-ordered discipline, peace and harmony."  Pope Pius XI

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux