You may redistribute this newsletter for non-commercial purposes. For commercial use contact firstname.lastname@example.org. To subscribe or unsubscribe go here or drop Jack an email.
It has been two years since my last salary survey. Follow this link to take the 2020 version (it's only a dozen questions), which also has a question probing your work in these coronavirus times. I'll publish the results in the May 4 Muse. Three copies of The Art of Designing Embedded Systems will be awarded to three randomly-selected participants. Based on early results, the vast majority of us report we're working from home due to the virus.
Jack's latest blog: Lessons From a Failure
I'm on the AmpHour ("Keeping You Current") this week.
|Quotes and Thoughts
The schedule you develop will seem like a complete work of fiction up until the time your customer fires you for not meeting it. David Akin
|Tools and Tips
Please submit clever ideas or thoughts about tools, techniques and resources you love or hate. Here are the tool reviews submitted in the past.
When faced with an intractable bug... wash your hands!
A new(ish) site for industrial IOT is interesting.
Percepio, responding to engineers working at home during the Coronavirus pandemic, are offering two months free use of their Tracealyzer.
|Freebies and Discounts
This month's giveaway is a BBC Micro:bit Go Bundle.
Enter via this link.
|More on Reuse
In reply to the last Muse's comments on reuse, Stuart Jobbins wrote:
John Carter commented:
|Sequence Points in C
Do you know what this code does?
sum = sum * 10 - '0' + (*p++ = getchar());
Don't feel bad; no one does. As the standard says: "the actual increment of p can occur at any time between the previous sequence point and the next sequence point (the ;), and the call to getchar can occur at any point prior to the need of its returned value."
The standard lets compilers evaluate parts of an expression with all of the discipline of sailors at a bar on shore leave. It says "The order in which subexpressions are evaluated and the order in which side effects take place, except as specified for the function-call (), &&, ||, ?:, and comma operators" is unspecified.
To give us predictability the standard has the concept of sequence points, To quote the standard again: "The presence of a sequence point between the evaluation of expressions A and B implies that every value computation and side effect associated with A is sequenced before every value computation and side effect associated with B."
A sequence point occurs on:
So be very wary of expressions like:
b = a + a++;
The value of b is going to depend on the order of evaluation of the expression.
Because logical ANDs cause sequence points an expression like:
a++ && a++
is perfectly legitimate. But my preference is to avoid such constructs that may confuse the unwary.
Do note that adding a Lisp-like swarm of parenthesis will not change the compiler-generated order of evaluation.
MISRA rule 13.2 addresses sequence points: "The value of an expression and its persistent side effects shall be the same under all permitted evaluation orders." (Emphasis in original).
CERT rule EXP30-C is more succinct: "Do not depend on order of evaluation between sequence points. "
Do you know C operator precedence rules? I don't. At least, not well. Most of us stumble when queried about this. In fact, in Developer Beliefs About Binary Operator Precedence by Derek M. Jones shows that even experienced developers strike out when asked which of C's 18 operators is evaluated before the others:
John Watson was surprised when he found out that Sherlock Holmes didn't know that the Earth revolves around the sun. Holmes said "What the deuce is it to me? You say that we go round the sun. If we went round the moon it would not make a pennyworth of difference to me or to my work." I feel the same way about precedence rules. They are arcane and uninteresting. Much better: use parenthesis when the order of evaluation isn't crystal clear.
Clarity is our goal.
|This Week's Cool Product
iRobot is launching a robot programming education initiative. They have (free!) on-line tools which let students develop and simulate robots. Looks like fun!
Note: This section is about something I personally find cool, interesting or important and want to pass along to readers. It is not influenced by vendors.
Let me know if you’re hiring embedded engineers. No recruiters please, and I reserve the right to edit ads to fit the format and intent of this newsletter. Please keep it to 100 words. There is no charge for a job ad.
|Joke For The Week
These jokes are archived here.
Tis the dream of each programmer,
|About The Embedded Muse
The Embedded Muse is Jack Ganssle's newsletter. Send complaints, comments, and contributions to me at email@example.com.
The Embedded Muse is supported by The Ganssle Group, whose mission is to help embedded folks get better products to market faster.