In c language programming, should I favour:
typedef struct
{
Point_t points[4];
} Quad_t;
Over:
typedef Point_t Quad_t[4];
In terms of performance? and best practice?
Note that Point_t
is defined as follows:
typedef union
{
struct
{
int x;
int y;
};
int coords[2];
} Point_t;
I found the first approach more readable and easier to handle when quads are passed across functions, however, the second approach just seems more direct.
Also, I couldn't sense difference in performance using either but I'm assuming that's because only a small portion of my code is using this type. (but still, I'd like to learn this tip for the future)
Many thanks in advance.
Hasan.