On 01/18/2008 09:05 AM, till busch wrote: > i've started to run fg through valgrind. i found this to be a nice option for > getting an overview over the code in flightgear.
1) This is important, valuable, and overdue. 2) It's going to be a lot of work. That's because 2a) Although it is easy to write valgrind-clean code, once somebody has written unclean code it is not necessarily easy to clean it up. 2b) Although some of the FGFS code is exemplary c++ code, some of it is not. Some of it is what we call "c-- code compiled with the c++ compiler". The point is is, c++ is a different language from c--, and unfortunately some of FGFS code exhibits a deep non-understanding of the purpose and capabilities of the c++ language. This is related to the recent discussion (in another thread) of "memory management". C++ is perfectly capable of automatic memory management, if allowed to do so. Sure, c++ gives folks enough rope to hang themselves (in contrast to e.g. java, which gives them less rope) but c++ does not /require/ anyone to hang themselves. As a simple guideline, with few exceptions, one should put new and delete in constructors and destructors, and then let the automatic memory management do its thing. Yeah, I know this is more work than manually newing and deleting things, but it makes the code vastly more reliable, more maintainable, more readable, more reusable, and more extensible. There's waaay too much c-- style manual memory management in FGFS, for no good reason ... and waaay too many memory leaks. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel