Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Q: Performance for public vs protected data in C++ (OT)

Author: Bo Persson

Date: 12:39:07 10/18/02

Go up one level in this thread


On October 17, 2002 at 19:29:30, Peter Fendrich wrote:

>Is there any reason why 'protected' data should have better performance than
>'public'? What could the compier do with this extra information?
>Peter

No, and nothing.  :-)


Making a member private stops *you* from updating it from where ever in the
program. *That* might improve your code and let the compiler optimize better.

The compiler can see all of your code, and does not have to trust in
declarations. Rather it checks them out to see if they are correct!


BTW, 'protected' data is *very* rare. Use 'private'.



Bo Persson
bop2@telia.com



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.