Const Function Parameters?
Felix Nawothnig
felix.nawothnig at t-online.de
Wed Jul 27 09:21:16 CDT 2005
Andreas Mohr wrote:
> While I'm not too convinced in this case (1.5% improvement sounds like
> within statistic noise), it should be a good idea to mark things in Wine
> const whenever possible (objdump -x helps here), since it improves reliability
Huh? He did stuff like...
-void foo(int i)
+void foo(const int i)
This will most likely not improve reliability. He also changed some
pointers to const which is wanted and will ofcourse improve reliability.
Assuming that gcc has a pretty good optimizer the only reason I can
think of (besides a GCC bug :-) why performance increased is that gcc
doesn't have to perform aliasing-analysis and can be sure that the dst
pointer will never point into local parameters (constifying local
variables could speed up things slightly more).
I'm not sure about the "restrict" semantics but maybe it could be used
instead of constifying "int i" to archieve the same effects?
Felix
More information about the wine-devel
mailing list