MemSet and C++ Classes -- or the tragedy of the BOINC client (and Server)
not being written in ADA 95 (or whatever version it is currently at) ...
The real tragedy is that the BOINC Client and Server are not written in ADA.
ADA forces people away from a lot of the syntactical nonsense that most
other languages permit.
You cannot even compile an ADA project unless it is self consistent.
JAVA comes close to ADA in its enforcement of "not allowing the programmer
to do incoherent things" typical mistakes.
Neither JAVA or ADA are perfect.
Yet the upper level 'assembly language' mistakes that C, C++ etc permit
without question are not so easy to do in ADA.
One would think that Berkley Uni (that gets gobs of defense research
funding) would have forced most of its 'mission critical' computer projects
to be written in ADA.
Sadly, because SETI @ Home was written in C++ ... BOINC became written that
way.
Now the middleware that runs SETI, Rosetta, etc ... is C++.
"It is like being shackled to a corpse..."
-- In the 1st World War, a German officer (but many Germans in the later
years of the war) described the relationship between Austria-Hungary and
Germany as "Being Shackled to A Corpse" (in translation, it is often
"Fettered to A...").
-- C++ and BOINC are related in this way. It causes no end of grief. C++ is
still at best an upper level assembly language.
MP
DSN @ H
-----Original Message-----
From: Nicolás Alvarez
Cc: [email protected]
Subject: Re: [boinc_dev] MemSet and C++ Classes.
2014-01-09 10:50 GMT-03:00 McLeod, John <[email protected]>:
In short, don't use memset on any structure that includes a class.
The class constructor may intentionally set internal variables that are not
0.
The implementation of each class may vary from platform to platform, and may
vary over time. These bugs can be hard to track down. Much better is to
use classes and constructors / destructors for everything. The built in
default constructor if you don't declare one is supposed to set all values
in the class to 0 or null. The built in destructor does nothing.
Here are five real (fixed) bugs caused by memsetting things that aren't
supposed to be memset:
http://boinc.berkeley.edu/gitweb/?p=boinc-v2.git;a=commit;h=8728c049
[...]
http://boinc.berkeley.edu/gitweb/?p=boinc-v2.git;a=commit;h=3db80eb5
_______________________________________________
boinc_dev mailing list
[email protected]
http://lists.ssl.berkeley.edu/mailman/listinfo/boinc_dev
To unsubscribe, visit the above URL and
(near bottom of page) enter your email address.