Thread 105838534 - /g/ [Archived: 583 hours ago]

Anonymous
7/8/2025, 5:33:26 PM No.105838534
1750028371584774
1750028371584774
md5: 739ae942744d71a2de83230fda3fdf95🔍
>Use modern C++, it's so good!
>Program becomes completely unreadable at-a-glance because templates are extremely verbose and noisy
>Program becomes virtually undebuggable too, because the debugger can't cope with complicated template instantiations
>Sometimes the debugger has a seizure and can't figure out the callstack when inside of a variant visitor variadic helper
What's the actual gain here, exactly? Why does it seem like the general trend in technology has been to just make everything as shit as possible? Just creating and adopting new practices for "something new" regardless of if it's actually better?
Anonymous
7/8/2025, 5:38:21 PM No.105838585
These features are mostly there to cover niche use cases and problems. You probably shouldn't just cram every C++ feature in your program.
Replies: >>105838611 >>105838653
Anonymous
7/8/2025, 5:41:07 PM No.105838611
>>105838585
but most of these are "standard" replacements for c semantics, eg std::option instead of pointers, std::variant instead of tagged unions, std::array, etc.
the stance i have always seen from developers has been "use the C++ versions of things as much as possible"
but the C++ versions of things seem to be worse in pretty much every way? like why would anybody use this shit?
Replies: >>105838653 >>105838712 >>105838812
Anonymous
7/8/2025, 5:44:56 PM No.105838653
>>105838585
>>105838611
Also I mean using "modern C++ development patterns" which involves a lot of heavy template usage when designing your data structures, not just using the STL
Replies: >>105838726
Anonymous
7/8/2025, 5:49:17 PM No.105838712
>>105838611
>std::option instead of pointers
nigger std::option is not a replacement for pointers, C uses pointers for fucking everything so C++ has like 30 different features that replace different use cases.
Replies: >>105838809
Anonymous
7/8/2025, 5:50:19 PM No.105838726
>>105838653
you don't template shit that doesn't need to be templated, retard.
Replies: >>105838809 >>105838847
Anonymous
7/8/2025, 5:56:02 PM No.105838809
>>105838712
pointers are the de facto way to represent option types in c, you could have inferred that from the context. a little good faith goes a long way anon.

>>105838726
templates are a turing-complete metaprogramming language, not just generics, and modern c++ expects you to use them a lot not only for things like conditional compilation and abstraction, but for enforcing and guaranteeing "safety" at compile-time by defining a DSL within the template system as a collection of predicates over types (like how the standard provides std::is_pointer)
have you written much modern c++?
Replies: >>105838847
Anonymous
7/8/2025, 5:56:06 PM No.105838812
>>105838611
it sounds like you learned c++ from a retart
Anonymous
7/8/2025, 5:58:59 PM No.105838847
>>105838809
>>105838726
also you're expected to use them in places where you might not expect. eg making a function templated such that you can pass a lambda as the templated type, so that the compiler can properly inline the lambda, rather than passing a function pointer, or god forbid, std::function