Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!usc!jarthur!uunet!taumet!steve From: steve@taumet.com (Stephen Clamage) Newsgroups: comp.lang.c++ Subject: Re: const Performance benefits {Was: const is not object-oriented} Message-ID: <517@taumet.com> Date: 18 Nov 90 00:30:25 GMT References: <13050@cadillac.CAD.MCC.COM> <1990Nov12.184240.23430@odin.corp.sgi.com> <11935@life.ai.mit.edu> Organization: Taumetric Corporation, San Diego Lines: 16 rpk@rice-chex.ai.mit.edu (Robert Krajewski) writes: !I'm no language innocent, but I'm not familiar with the performance !benefits of using const. (I'm certainly aware of the safety !benefits.) !The only one I could think of is that the compiler could re-order !function calls in expressions. It allows a number of optimization opportunities. The major one is that unless declared extern, a const scalar type need not be assigned to memory, and if the definition is visible the literal value may be used instead of reading it from storage. -- Steve Clamage, TauMetric Corp, steve@taumet.com