BitTorrent client Transmission moves from C to C++

The libtransmission library underlying the Transmission BitTorrent client has been translated to use the C++ language. In Transmission, there are still bindings with the implementation of user interfaces (GTK interface, daemon, CLI) written in C, but assembly now requires a C ++ compiler. Previously, only the Qt-based interface was written in C++ (the macOS client was in Objective-C, the web interface in JavaScript, and everything else in C).

Porting was done by Charles Kerr, project leader and author of the Qt-based variant of the Transmission interface. The main reason for the transition of the entire project to C ++ is the feeling that when making changes to libtransmission, you constantly have to reinvent the wheel, in the presence of ready-made solutions for similar problems in the C ++ standard library (for example, it was necessary to create your own functions tr_quickfindFirstK () and tr_ptrArray () in the presence of std: :partial_sort() and std::vector()), as well as providing more advanced type checking facilities in C++.

It is noted that the developers do not set themselves the goal of immediately rewriting the entire libtransmission to C ++, but intend to implement the transition to C ++ gradually, starting with the transition to compiling the project using the C ++ compiler. In its current form, the C compiler can no longer be used for assembly, as some C++-specific constructs have been added to the code, such as the "auto" keyword and type conversions using the "static_cast" operator. Support for older C functions is planned to be retained for compatibility, but developers are now encouraged to use std::sort() instead of qsort() and std::vector instead of tr_ptrArray. constexpr instead of tr_strdup() and std::vector instead of tr_ptrArray.

Source: opennet.ru

Add a comment