Petite question liée aux structures
Bonjour tout le monde !
En lisant cet article :
http://www.osc.edu/hpc/manuals/ia64/...g/linux120.htm
Je suis tombé sur cette phrase :
Citation:
As an example, suppose that a function uses local variables i and j as subscripts into a 2-dimensional array. They might be declared as follows:
int i, j;
These variables are commonly used together. But they can fall in different cache lines, which could be detrimental to performance. You can instead declare them as follows:
__declspec(align(8)) struct { int i, j; } sub;
The compiler now ensures that they are allocated in the same cache line. In C++, you can omit the struct variable name (written as sub in the above example). In C, however, it is required, and you must write references to i and j as sub.i and sub.j.
Lorsque je n'appelle mes variables que i ou j, le compilateur me dit ne pas les connaître, et je suis obligé d'écrire sub.i et sub.j.
Où est l'astuce ?
Merci d'avance ! :)