TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Neil Heller
from: Bill Birrell
date: 2004-04-12 23:34:00
subject: Squares

> That bring up an interesting point.  It is such a
 > common thing to
 > compare the loop counter to a result involving the
 > loop counter in some
 > sort of function

 >        (ie:  (for n=0; n that I would consider it only natural that any
 > optimizing compiler would
 > do what you did, only automatically.  Is this the
 > case?  Or should I be
 > concerned with optimizing manually - not trusting the
 > compiler
 > manufacturer?

    I wouldn't rely on it happening automatically, Neil. It's actually a
little more than an optimization. It's a real change in the program to
eliminate a needless bottleneck. I'm not sure optimizers are allowed to
take such liberties. I'd check with one of our resident gurus, like
Bob Stout or Darren McB.

    OTOH you can check for yourself by compiling both programs, each with a
slightly different name, and then check the execution times. That would be
a practical and pragmatic way to be sure of what your own favourite
compiler does.

Best Wishes,
Bill.

---
* Origin: Escan BBS (2:25/200)
SEEN-BY: 633/267 270
@PATH: 25/200 108 252/110 250/501 140/1 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.