We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello
Normall in an application we define global variable as: int a; int b; ...
How about use one structure to include all variables, and just define one structure instance? as below: struct{ int a; int b; ... }global;
Is the performance slower? does it take more code space? Is there any other drawback?
Thanks.
/Wang
Thank you to point out this possibility (but I would not recommend packing, unless really required - if you pack the structures and you have an uneven number of char's and short's in your structs, you will run into alignment problems - that's why I recommended to fill with "free" char's / short's).