Hi, On Mon, Jan 14, 2013 at 09:45:24PM +0100, CeDeROM wrote: > Well in fact after over year I got used to current C code, but the > problem with that is the code readability, program flow, names, etc. > Using C++ would give us objects and methods, that would dramatically > increase readability, program flow and extensibility... understanding > the code, clear organization and distinction of functionalities is a > benefit here...
It seems to be little known that modern C++ is capable of producing a rather efficient code, often better than hand-crafted C, provided it is used by competent C++ developers. Even RTTI and exceptions are not an issue performance-wise because you can easily avoid using them specifically on the hot pathes (e.g. exceptions should be used only for really exceptional situations, and there a bit of performance hit of stack unwinding doesn't matter, and virtual functions are not needed that often either (though Java devs would disagree ;) )). BTW, GCC "switched" to C++ recently, and LLVM was using it right from the beginning. It seems to be assumed by most people here that C++ benefits lie mostly in its OOP model, inheritance and such. Andrei Alexandrescu would disagree [0]. In fact the language designers are concentrating currently on compile-time efficient type-safe generic programming. The template language evolved into a pure-functional Turing-complete compile-time language. One of the popular examples is the Boost::Spirit library which compile-time generates very efficient parsers from an "almost EBNF" description right from the C++ sources [1]. So the main benefits of using C++11 would be: compile-time type-safety, efficient compile-time meta-programming. And of course, cleaner, safer, more maintainable code as the result. The downside would be that C++11 and its "advanced" template facilities are harder to learn and many people would like to use it like a dialect of Java (preferring inheritance over composition, avoiding template programming etc, which would indeed be highly inefficient and inelegant). To get a taste of modern C++ you can watch this introductory video by one of the core designers, Herb Sutter: (Not Your Father’s) C++ [2]. One step that might bring OpenOCD closer to the modern programming practicies would be to make it buildable with g++ without any real redesign (similar to what GCC developers did with their compiler). [0] http://en.wikipedia.org/wiki/Modern_C%2B%2B_Design [1] http://www.boost.org/doc/libs/1_52_0/libs/spirit/doc/html/index.html [2] http://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2012/-Not-Your-Father-s-C- HTH -- Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! mailto:fercer...@gmail.com ------------------------------------------------------------------------------ Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS and more. Get SQL Server skills now (including 2012) with LearnDevNow - 200+ hours of step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only - learn more at: http://p.sf.net/sfu/learnmore_122512 _______________________________________________ OpenOCD-devel mailing list OpenOCD-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openocd-devel