Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [4diac-dev] Migrating forte to +11

Hi Alois,

On 10.06.20 21:02, Alois Zoitl wrote:
I have rather mixed feelings here. At first I see the cool features of modern C++ (e.g., lambdas, const expr) which can help to improve code quality and flash
size.

Also think of more limited devices that cannot run forte yet (Cortex-M with 128k flash?). With these features, it would become easier to address such resource-constrained devices. Lots of compile-time optimisation beyond constexpr, much better control over memory through polymorphic memory resources. std::string with short string optimisation, the list of useful features is long.

Also think of security: Programming according to the C++ Core Guidelines will go a long way to eliminate accidental memory errors -- although forte does not show any obvious flaws in this area, it hasn't been audited or penetration-tested, or has it?


However I also see that we have a very diverse community with many different OSes (e.g., I hear that ThreadX is coming back via some Microsoft initiative),
different CPUs and memory capacity. While I thought most of our hardware will be arm and Linux based by now it looks not like that will come. Also RAM is still
a crucial thing in many devices of our users. Just have a look at the current discussion in the forum.

I would expect RAM usage to be lower with C++11 or later. But rare platforms are a problem indeed.

Unlike the current cross-platform approach, I don't see an easy way to use C++11/14/17 features in a way that allows fallback implementations for platforms that don't have full library support for C++11 -- for example, there's a big difference between using constexpr and std::thread on FreeRTOS. I'd expect the former to be Just Working, the latter to require explicit FreeRTOS support in the standard library.

On the other hand, we already need C++ support. My experience is that people resist C++ on exotic platforms because of the misconception that it is inefficient or bloated, but we are already beyond that. Getting C++11 support as an upgrade should be much easier than getting C++ support in the first place. Generically speaking, I think it is reasonable to require support for an almost 10 year old standard. We're not the only ones who want to use modern C++.

As for C++ beyond 11, there is https://abseil.io, which maps C++14/17 features to 11 if the compiler doesn't support the newer versions, and uses the native implementation if it does. That might be a pragmatic compromise.

We should probably begin by checking all platforms that forte officially supports. Do we even have access to all of them, or are some of them orphaned? We should maybe also explicitly ask users on which kind of systems they use forte, so we can discover exotic platforms we happen to support without knowing it.


Therefore, in order to not limit the applicability of 4diac FORTE I think we should proceed here with great caution. Also I don't think we should spend our
limited resources on the transformation because of transformation. Especially because of our great set of test case. Thanks to all who worked on that.

I agree that if we do this step (which I really hope to become true), we should be fully aware what we break, that there are upgrade options for all users, and that these options are reasonable.


There are places where I see some immediate benefits (e.g., replacing our single linked list with STL vector), which can reduce our memory usage further. But it
would need some experiments to see if STL is not bringing other drawbacks regarding memory (e.g., memory blocked by support functions).

When talking about the big three (gcc, clang, Microsoft), using library features are highly likely to be better than a hand-coded solution. Regarding STL vector, polymorphic memory resources are very interesting for memory-constrained platforms (std::pmr:vector). That is a C++17 feature, however.


Regards,
--
Dipl.-Inform. Jörg Walter
Senior Researcher
R&D Group Distributed Computation and Communication

OFFIS e.V. - Institut für Informatik
FuE Bereich Produktion | R&D Division Manufacturing
Escherweg 2, 26121 Oldenburg - Germany
Phone/Fax.: +49 441 9722-729 / -282
E-Mail: joerg.walter@xxxxxxxx
URL: http://www.offis.de

Registergericht: Amtsgericht Oldenburg VR 1956
Vorstand: Prof. Dr.-Ing. Wolfgang H. Nebel (Vorsitzender),
    Prof. Dr. techn. Susanne Boll-Westermann, Prof. Dr.-Ing. Axel Hahn,
    Prof. Dr.-Ing. Andreas Hein, Prof. Dr. Sebastian Lehnhoff


Back to the top