Embedded Systems December 2000 Vol13_13

Issue link:

Contents of this Issue


Page 8 of 197

Parity Bit Reader Fragments "The decision in Michael Barr's coI- I umn "Inte rne t Working" (Se p tember 2000, p. 69) to exclude imple- menta tion of fragmentation and reassembly is the right one. Today, most traffic on the Internet is initiated by Windows 95/ 98/ NT/ 2000 systems. By default, fragmentation is turned off on those systems. Only 2% to 5% of the packets on the Internet are fragmented, and, it turns out, many of those are sent by hackers. Other cases occur because of misbehaving systems. An e-mail to the sysadmin usually solves the problem. Lawrence Lu Linguistic diversity A few weeks ago, I read an article #'\in a magazine (I d on 't know whe the r it was ESP) that pointed ou t the need for all programmers to do some activity to compensate fo r a particular defi ciency of C, C++, and J ava. Wha t was irrita ting was that thi s statement-indeed most of th e article-was written as if no oth er languages existed. urn an atutuue \ l> un\ottunate because every language has at least one advan tage ove r others. When there is a flaw in one language, there's sure to be a language somewhere that does not have that flaw. I was pleased to see th at the October issue of ESP does acknowl- edge that C, C++, and J ava are not th e only game in town and that ESP doesn' t pretend they are the best of all possible worlds. I refer specifical- ly to the articles "Measu re Twice, Cu t Once," by J ohn Fusco (p. 36) and "From OOP to Nuts," by Chad Bremmon (p. 78). The fi rst, th ough not about languages, points out a few flaws of C++, and the second shows how Ada is be tte r than C++ for some aspects of OOP. Thanks. It would be nice to see more such articl es. Perhaps other lan- guages (Eiffel?) could also receive a little attention. Wes Groleau RAYTH EON ( had Bremmon, in his article "From OOP to Nu ts" (October 2000, p. 78) correctly notes that tlle central prob- lem of Thomas Niemann's "Nuts to OOP" article (August 1999, p. 16) is a misunderstanding of how and when to use object-oriented techniques. Later, howevel~ he seems to make a similar mistake, blaming C++, rathel- than sim- ple lack of know-how, fo r tlle poor code that led to Mr. Niemann's sen- tence: "What he ought to say is 'Nuts to C++!'." The remainder of th e article then offers up Ada95 as a superior lan- guage to C++ withou t any objective evidence of exactly how he reached this conclusion. I would suspect that his bias, like tllat of many othel-devel- opers, is simply based upon his famil- \an-ry mID 1\.0:<.\ \n'till> ,.,on, ann not on any hard evidence. The fact is that bad code can be wr itten in Ada too. If C++ were such a "flawed" language, then why are more and more mission-critical sys- tems, in clud ing avioni cs, switchin g from Ada to C++? If Ada truly "e tab- lishes a highe r standa rd" in read- abili ty, reusabili ty, and so on, then why are the prin cipal Ada users those rela ted to the mili tary, for which Ada was mandated, rather th an actually selected by the devel- ope rs themselves? Why do defense contracto rs (including my own com- pany) find- that quali ty software enginee rs simply prefer C++ (and potential new hi res run fo r the exits rather than wri te Ada)? Again, while I agree witll most of Mr. Bremmon's poin ts about OOP in gener- al, I have found that Ada promoters often seem to confuse readability witll verbosity. As an exercise, I reimplement- ed his Ada register class in C++ below. I will leave it to tlle reader to decide which language is better suited [or his or her embedded systems proj ect. II decLaration of Register type class Regi ster { pubLic: Register(unsigned Long addr); void write(unsigned shortvaLue); void read(unsigned short&vaLue); private: voLatiLe unsigned short*regAddr; }; II impLementation: 11 Lines of c++ II vs. 26 Lines of Ada Register::Register(unsigned Long addr) : regAddr«unsigned short*)addr) {} ~o\o ~e~\s~e\ ~~~\\~e\uns\~neo short vaLue) { *regAddr = vaLue; } void Register::read(unsigned short& vaLue) { vaLue = *regAddr; } II usage of the Register cLass: II again, simpLer than the Ada Register myRegister(someAddr); myRegister.write(vaLue); Bill Emshoff LO C KH EE D MART IN Embedded Systems Programming DECEMBER 2000 7

Articles in this issue

Archives of this issue

view archives of EETimes - Embedded Systems December 2000 Vol13_13