|
06.11.09 C++ Tips For Embedded Types By
Doug CaverlyDriving skills don't always translate from one type of competition to another. A top-notch rally driver might fail in F1, for example, or someone who's had luck in drag racing might not make the grade on Nascar's oval tracks. And the same sort of thing holds true when it comes to software, so Colin Walls wrote a guide to C++ specifically for embedded developers. Walls listed five good ideas and five things embedded developers should avoid; we'll just try to hit a couple of highlights here. First, a simple but smart suggestion: "Understand how C++ actually works. . . . For example, if you think the two statements i++; and ++i; are always identical in C++, think again. (They yield the same result, but the postfix operator probably requires intermediate storage, so the prefix version may be more efficient.)"
A driver would never just hop into an unfamiliar car and take off in an important race, after all. Later, Walls pointed out, "Writing 'clever' code is never smart." The more complex something is, the more likely it is to go kaplooey. Plus, nobody likes a showoff. Heck, in car racing, this sort of behavior can end with braggarts getting spun off the track. Finally, "It is not logical to avoid language features just because your tools do not handle them well." Instead, get better tools. You don't see racing teams quitting just because they lose an engine or two, right? For other tips (that can less easily be treated as car analogies), don't forget to see Walls's original article.
|
|
| ||
|
-- CProgrammingTrends is an iEntry,
Inc. publication -- iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 2009 iEntry, Inc. All Rights Reserved Privacy Policy Legal archives | advertising info | news headlines | free newsletters | comments/feedback | submit article |