Good C programming practices talk about passing variables as parameters to function opposite to global vars. I have seen in my own programs this is a good practice as the compiler optimize those variables very well.
Now I have a problem. My new program uses a vector of very large structs. I have noted I can not pass the complete struct as a parameter as it takes many time to copy the structure, so the only plausible way to do it is passing a pointer to the struct I am going to modify.
So far is ok, but I have doubts about the way the compiler optimize the struct access thought the pointer. I have hear of aliasing been a optimization problem when using pointers, but I have not clue what this mean. My program is not multithread so I am sure there is only single access to variables, but I know the compiler does not know that and it does not optimize this kind of access the same way as it would ve a parameter variable of the function.
I admit I am completely stupid in how the compiler works, about all when working with pointer, so my question is what must I have take into account in order to point the compiler to optimize in the best way the access to the struct thought pointers?, is there guidelines on how can I take the best optimization of them? must I instruct the compiler (via options or via programming) to best optimize?