It is virtually impossible with any kind of optimizing turned on to write a 
C code program with a loop like this. 
unsigned long
loop(unsigned long iterations) {
    unsigned long i;
    for (i = 0; i < iterations; i++)
        ;
    return(i);
}
Most compilers (gcc, DECC, HP C, Sun) will convert this code to:
        return iterations;

On 2 May 2002 at 9:40, Alex Hewitt USG wrote:

> Imagine if the OS were smart enough to recognize that you were copying to
> /dev/null and would simply optimize that operation out of existence! Now *that*
> would be fast.
> 
> Years ago 'C' compiler writers noticed that folks were attempting to benchmark
> the program that came out of their compiler by running a program called the
> "Sieve of Erastophanes". These bright compiler writers would look for the code
> pattern and simply throw away the code replacing it with a table print out!
> Needless to say their compiler would look great compared to one that actually
> did the work. Similar games were played in the video card space...
> 
> -Alex
> 
> 
> Wirth's Law: Software gets slower faster than Hardware gets faster!
> 
> "On the side of the software box, in the 'System Requirements' section, it
> said 'Requires Windows 95 or better'. So I installed Linux."   - Anonymous
> 
> The closest I'm going to get to retirement is when I put new Michelins
> on my car!
> 
> 
> 
> *****************************************************************
> To unsubscribe from this list, send mail to [EMAIL PROTECTED]
> with the text 'unsubscribe gnhlug' in the message body.
> *****************************************************************


--
Jerry Feldman <[EMAIL PROTECTED]>
Associate Director
Boston Linux and Unix user group
http://www.blu.org PGP key id:C5061EA9
PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9


*****************************************************************
To unsubscribe from this list, send mail to [EMAIL PROTECTED]
with the text 'unsubscribe gnhlug' in the message body.
*****************************************************************

Reply via email to