Computer Chess Club Archives


Search

Terms

Messages

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

Author: Bo Persson

Date: 12:34:12 10/18/02

Go up one level in this thread


On October 18, 2002 at 09:11:30, Gerd Isenberg wrote:

>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
>
>Hi Peter,
>
>access qualification has no impact on performance. Another thing are 'const'
>functions. The information that a function does not change anything inside this
>object permits the compiler to do additional optimizations, eg. holding data
>members in registers.
>
>Gerd

No!

The compiler can see for itself whether you change the data or not. If you
declare a member function const and then try to change the object anyway, the
compiler complains. Because it can tell!




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.