Hello.
Is the same this two ways of use n:
or this one:Code:t_mytype * restrict n; // Global n void myfunc() { n->result = n->var1 + n->var2 + n->var3; }
I read it is a good policy that when using a global var, prefer to copy it into a local one, but a quick speed test say to me 2 example is worse. As I dont absolutely sure what I do is correct, could you please explain me what system is better in order to use n (in terms of speed)Code:t_mytype * restrict n; // Global n void myfunc() { t_mytype * restrict p = n; p->result = p->var1 + p->var2 + p->var3; }
thanks.



2Likes
LinkBack URL
About LinkBacks



