On Wed, 16 Sep 2009, Enrico Maria Giordano wrote: > > I see the previous changes of Phil, some days ago > > i decided not port to xharbour (const) beacause it only > > changes speed by security under some compilers. I remark > > some compilers (BCC for example almoust at my machine) > I can't see how the const specifier can reduce the program speed. Did you > have a test that demostrates this?
It may only increase the speed because it gives information to compiler that the body of string cannot be changed by called function so it's possible to use deeper optimizations. Runtime protection (if any) is done using readonly memory segments and it also can only increase the speed because CPU can use cache more efficiently when it knows that some memory pages cannot be modified, i.e. it does not have to update or sync them on write. There is no technical reasons to reduce the speed by using 'const' modifier everywhere it's possible but they are situations when missing 'const' reduces the speed. So it improve the speed and also gives additional compile time protection which nicely helps to locate and fix some type of bugs. best regards, Przemek ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ xHarbour-developers mailing list xHarbour-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xharbour-developers