Using pointers for this may make it impossible in some situations for some compilers to optimize them, which makes performance worse than using ordinary variables. However, for this particular example, pointers are likely to be optimized in all cases that I can think of.
In your case, I recommend using local #defines inside the function body, and then #undef them again to the end of the function.
Sort of...
int foo (struct1 *in_strct1, struct2 *in_strct2, struct3 *out_strct3)
{
#define a (in_strct1->sublevel1.sublevel2.somearray[5].a)
#define b (in_strct2->somearray[3].sublevel2.sublevel3.b)
#define c (in_strct2->someotherarray[6].inside.even_deeper_inside.almost_there.c)
#define res (out_strct3->a_very_long_corredor.behind_the_blue_door.under_the_table.inside_the_box.on_the_left.res)
res = (-b+sqrt(pow(b,2)-4*a*c))/(2*a);
return 0;
#undef a
#undef b
#undef c
}
source
share