I tried using limited qualified pointers and I ran into a problem. The program below is just to introduce the problem.
The calc_function function uses three pointers, which are limited, so they "MUST" not be aliases with each other. When compiling this code in visual studio, the function will be built-in, so for no reason Visual Studio 2010 ignores qualifiers. If I turn off inlining, the code will run more than six times faster (from 2200 to 360 ms). But I donβt want to disable the attachment in the whole project and the whole file (because then it will be an overhead for a call, for example, for all getters and setters, which would be terrible).
(Can the only solution disable the attachment of this function only?)
I tried to create time limits for qualified pointers in a function, both on top and in the inner loop, in order to try to tell the compiler that I promise that there are no aliases, but the compiler will not believe me and this will not work. I also tried setting the compiler options, but the only one I found that works is to disable inlining.
I would appreciate help in solving this optimization problem.
To run the program (in realeasemode), remember to use the arguments 0 1000 2000. Why use the arguments of userinput / program to make sure that the compiler cannot know whether or not anti-aliasing exists between the a, b, and c pointers.
#include <cstdlib>
Boll
source share