Liste des Groupes | Revenir à cl c |
On 15/10/2024 12:41, Bonita Montero wrote:I think C could be improved a lot with something like ChatGPT to create parametrized containers.Am 15.10.2024 um 05:30 schrieb DFS:Sure, because every time you start a new C app, you're starting from zero.On 10/13/2024 6:51 AM, Bonita Montero wrote:>Am 12.10.2024 um 23:37 schrieb Thiago Adams:>
>If you are afraid your constant is not constant expression put a static_assert. Then remove.>
This is unnecessary work if you have constexpr.
>(C++ is a TOTAL mess. const in C++ already could be used n constant expression)>
C++ is five to ten times less work for the same problem.
>
How do you measure "work'?
In lines of code. Imagine you would specialize a container like
unordered_map by hand in C. That would be days of work. In C++
it's one line of code and you get nearly optimal performance.
Or just think about what an emplace_back on a vector of strings
all does; if the capacity isn't sufficient a doubled vector is
allocated (libstdc++, libc++), all objects are moved there and
a new item is emplaced at the end. That's one line of code, but
in C that's a half day's work.
>
There are no existing libraries to use. No online examples to use as templates. There are no examples of hashtables or growable arrays that you've implemented over decades of your own work to draw from.
There is NOTHING.
In reality it isn't like that.
Use of C++ does have the advantage when posting bits of code in on-line forums, since there are a much larger number of /standard/ libraries that someone running your code will have access to in their installation, if the code fragment happens to use them.
Posted C code using a non-standard library would be problematical. That's probably why C code that use a hash-map, for example, may need to come with its implementation so it may appear to have a higher line count.
Les messages affichés proviennent d'usenet.