[bt-devel] Sword++ Help

Jaak Ristioja jaak at ristioja.ee
Tue Sep 27 10:58:34 MST 2016


Hi, Gary!

I must admit, that I'm a better developer than a project lead. There are
a number of things I've thought about which I'd want to improve, but I
haven't approached these goals very systematically, because I've just
reviewed and attempted to improve the code single-handedly up to this
point. So please don't take this reply to be comprehensive. Since I'm
limited by time, I haven't much thought about this from a project
management perspective, but mostly from a technical viewpoint.

Overall, we need to raise the level of abstraction. Sword++ currently
looks like "C with classes": there is a lot of unsafe strcpy and pointer
arithmetic being done, where one should rather use safer alternatives,
e.g. use std::string, iterators, ranges etc. We should use
std::make_unique, std::make_shared etc instead of malloc/calloc, which
will force us to use smart pointers and eliminate most memory leaks
right away. Using such abstractions would make the code easier much to
understand, help find bugs etc. I think the performance loss with all of
this is rather small if done properly. Since this is no HPC library,
performance doesn't matter as much anyway. Foremost, the code should
express intent.

But if you want something specific to work on right now, then look at
compiler warnings from GCC and Clang, cppcheck output. There are
probably some analysis tools based on Clang. We should probably
integrate with Coverity as well. Fixing these warnings will help us find
real bugs. This might help you get started. Or you could just explore
the code, try to comprehend it and ask yourself if it could be improved
in any way. I've found many places where one can rewrite the code so
that it better expresses the intent, or where one can deduplicate code,
use some std:: classes/algorithms to replace hand-written error-prone
code etc. Functions which return their status using char or int types.
These should probably return bool or enum values instead. I think I
could keep writing about similar things, but you will probably find the
C++ Core Guidelines [1] much better written as an introductory point.

I think it is too early to discuss larger architectural changes. But we
will get to those.

Many blessings,
J

  [1]: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines

PS: I haven't read through the whole of [1] myself yet. ;/


On 27.09.2016 03:41, Gary Holmlund wrote:
> Jaak,
> 
> I can help with sword++, but I am not sure where best to start.
> 
> A few ideas:
> 
> code - warnings, other specific area?
> 
> test - maintain the "tests" area
> 
> builds - windows and android 32 bit issues
> 
> 
> Your thoughts?
> 
> Gary
> 
> 
> 
> _______________________________________________
> bt-devel mailing list
> bt-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/bt-devel




More information about the bt-devel mailing list