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
this reduces performance, and, requires that every pointer that addressed that data is also packed. Still sounds like a good idea?
Yes, it does, for applications where extreme speed or code density is not very important. That would be a majority of applications, by the way.
@Mike Kleshov,
Well in my opinion, this is a very unwise approach. But this is merely my opinion.