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
Interesting views. Person #1 states that packing reduces performance and then Person #2 suggests the use of XML.
Why not check out my blog at http://www.kneeltronicals.com ? There's an entry about the importance of being objective.
Yes, but did you pick up what the view was?
XML is a solution where all data is sent together with metadata, so that a listener can pick out exactly what data that was sent - and what wasn't sent.
A protocol that just packs n variables binary after each other have no such metadata. Much more efficient use of the link. But with significant issues if fiels have changed offsets inside the binary package.
So everything is a trade-off based on what the major goals was.
When talking transfers, XML is more robust but with less efficiency than packed binary data. When talking about using global variables, then packed structs may be more space efficient but at the cust of code size and runtime.
I wouldn't recommend a solution that hurt code size and access speed when running the program, just to make it a bit simpler to get a magic block of data to send to the other side. Especially when there are still lots of issues to get the other side to be able to make use of that binary blob.
Yes I did. Just pointing out the humour.
Why not check out my blog at http://www.kneeltronicals.com ? There's an entry about the humour in opposite views that are both correct.
why would I ?
wade through a ton of irrelevat stuff to find what is relevant to this issue
BTW
for Cortex M3 (and some others) DO NOT PACK!
Erik
Erik Malund. You are as stubborn as your reputation!
Why not check out my blog at http://www.kneeltronicals.com ? There's an entry about mules and their traits.
Why not check out my blog at http://www.kneeltronicals.com ? There's an entry about mules and their traits. because I love Google Google will get me to the informatin I am looking for and I do not have to wade through tons of blabber. nothing personal, I do not read blogs, I do not have facebook, I do not have twitter.
if you want to dissiminate information put it where it goes do no make references to az place to search for it. If Instead of "Why not check out my blog" you could put up a link to the EXACT place where the relevant info was I would gladly look at it, but asking me to wade through a bunch of useless information will not work.
No fear of that: http://www.kneeltronicals.com/ is purely fictitious - there is no content whatsoever.