Re: C++ std::

2025-04-20 Thread Collin Funk
Hi Bruno,

Bruno Haible  writes:

> I try to avoid the C++ Standard Library, because

Thanks for the detailed response.

I certainly agree regarding the unreadability of the C++ standard
library.

Collin



Re: C++ std::

2025-04-20 Thread Bruno Haible via Gnulib discussion list
Hi Collin,

> Out of curiosity though, why not use std::unordered_map [1]? Is C++
> standard library not portable enough?
> 
> [1] https://en.cppreference.com/w/cpp/container/unordered_map

I try to avoid the C++ Standard Library, because

  * My general experience with C++ is that the more features from
the language I use, the more it turns into a waste of time, and
I have the suspicion that with the C++ library it would be
the same.

  * There are several implementations of the C++ Standard Library,
and I'm not inclined to start adding workarounds here and there,
like we did with C library bugs before Gnulib was invented.

  * I hate bloat, and the C++ Standard Library is bloated. Even
if a large amount of this bloat goes away through inlining and
compiler optimizations, I hate to read through the x86_64 instructions
generated by the compiler in order to understand what a certain
piece of code actually does. (Reading the libstdc++ code is not
an alternative, because the abuse of templates in C++ — originally
invented for containers — makes that code unreadable. For
comparison, the D language has similar amounts of bloat as C++,
but it's at least halfway readable.)

  * I hate to have duplicate code at the binary level. The C++ library
often instantiates the same code once for each set of template
parameters. Instead, I want to have control over which function
occurs only once.

  * The C++ Standard Library does not evolve monotonically. Up until
C++ 11, they added things in backwards compatible ways. But when
you peruse cppreference.com, you realize that starting with C++17
they remove features [1] or reorganize features in non-backward-
compatible ways [2].

Bruno

[1] https://lists.gnu.org/archive/html/bug-gnulib/2023-09/msg00054.html
[2] 
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=blob;f=gettext-tools/examples/hello-c%2B%2B20/hello.cc