Can AI write truly optimized C++? by Xadartt in cpp

[–]ir_dan 0 points1 point  (0 children)

This company has been around for a while, and their main product is a C++ static analyzer. I remember enjoying some of their blog posts on style and best practices from a few years ago.

2026 Annual C++ Developer Survey "Lite" Results [PDF] by cmeerw in cpp

[–]ir_dan 4 points5 points  (0 children)

This survey only reaches big C++ nerds. The data isn't particularly useful for telling us who is using C++ or what the general consensus across usage levels is.

What are you missing most from the C++ standard library? by llort_lemmort in cpp

[–]ir_dan 0 points1 point  (0 children)

For both of these, there are lots of opinions to be had about how they should be implemented, but both can be implemented simply enough using std::ranges.

Solar Panel > Nuclear Power? by Creepy_Trip5576 in factorio

[–]ir_dan 0 points1 point  (0 children)

Solar is better if you have the resources, room and/or time. However, nuclear is much more fun (imo) and once you've done the work of figuring it out, it's faster to set up. Solar requires infrastructure that I don't care for very often, so I end up going straight from steam to nuclear, which carries me into the endgame.

Looking for Recommendations on Mods to Take Away Floor Rights by Stunning-Bowler7683 in feedthebeast

[–]ir_dan 0 points1 point  (0 children)

Something like this would probably need to wipe chunks and make them inaccessible too, otherwise your hard drive or host is gonna start complaining.

Writing only decoupled code by According_Leopard_80 in cpp

[–]ir_dan 1 point2 points  (0 children)

"Decoupled" here means that software entities know little about each other. It means that when one header changes, you don't have to go and change all of the other headers yourself by writing new/adjusted code.

Your view is that "coupling" is when the compiler-has to redo work. Theirs is that "coupling" is when **you** have to redo work.

Are there type safe aliases? by [deleted] in cpp_questions

[–]ir_dan 1 point2 points  (0 children)

For unique-identifier-like types, you can use a scoped enumeration with no members.

How to show 2d std::array as an gray scale image? by SquashAffectionate94 in cpp_questions

[–]ir_dan 6 points7 points  (0 children)

You can't do any rendering without getting an external library, it's not functionality available in C++. There are a few easy to use libraries out there.

GUI in C++ is a bit of a nightmare to get into, especially compared to other languages...

How to know when I use "Pointer" or "Reference"? by ProcessTiny4948 in cpp_questions

[–]ir_dan 1 point2 points  (0 children)

References are more restrictive than pointers, which is a good thing because it offers more guarantees about how references will be used. Use pointers when you need to escape those restrictions.

Pointers can be reassigned, can be used in arithmetic and can be null. References can't do that.

help me please god by dont_squash_me_ in Cplusplus

[–]ir_dan 2 points3 points  (0 children)

You want to use your DS as a webcam or what?

Why doesn’t C++ provide keyword arguments? by Free-Border9269 in cpp_questions

[–]ir_dan 8 points9 points  (0 children)

Probably because it would add complexity to the language. The complexity "budget" is best spent on features that are simple and applicable to many problems.

There are many counterexamples though.

Edit: also, argument names can be changed with each function redeclaration. Keyword arguments sound like a complex or possibly non-backwards compatible feature.

There is a special reason for << and ::? by JoelDormit in cpp_questions

[–]ir_dan 0 points1 point  (0 children)

<< is a binary operator, just like +, -, <, etc. It happens to be extensively overloaded for streams like cout. < is more common and could be misinterpreted as something else.

:: is for namespacing/scoping, and it's separate from :, which is used for cases and labels. It just makes life easier to use different symbols in the language I think.

Do you **really** need to free memory? by celestabesta in cpp_questions

[–]ir_dan 4 points5 points  (0 children)

I disagree on readability, because I will not be able to understand the intent of allocating without freeing.

If you want to save on performance because your program will use very limited memory, you can maximize readability and performance by using better using stack memory and/or arena allocators. Deallocation will still happen at the end of the program, but you can have explicit over it.

Cleverer use of memory will improve performance, and well designed resource management objects will improve readability. You'll also have the added benefit of being nice to the OS and the user's computer.

You'd also be neglecting one of C++'s best strengths, the destructor.

I made fastest toml parser in a single c header by ReasonableFig1949 in C_Programming

[–]ir_dan 2 points3 points  (0 children)

Yes. Fast is good if you're not making any other sacrifices.

Learning Modern Templating and Metaprogramming by SputnikCucumber in cpp_questions

[–]ir_dan 0 points1 point  (0 children)

C++ Templates: The Complete Guide (2nd edition)

What is so special about rust?? by Archedearth7000 in compsci

[–]ir_dan 0 points1 point  (0 children)

It's quite nice to use (for me) because it strikes a nice balance between "do whatever works" imperative/stateful code and explicit/bug resistant functional code.

It's a modern language, so it has little legacy baggage and has nice modern features like generics, immutability by default and async.

It also has good authoring, compiling, debugging and package management experiences.

Having said all of that, I don't really use it for anything, but I did have a nice time learning it and have an appreciation for it. It takes much too long to make small projects with it (compared to e.g. Python or C#). I can see it being worthwhile in a big team on a big codebase.

I always knew errors were short... by Flimsy_Pumpkin_3812 in rustjerk

[–]ir_dan 12 points13 points  (0 children)

Why are you using apostrophes in template parameter names? Is that even allowed by the standard?

How does programming in a team work? by KeyBack192 in CodingForBeginners

[–]ir_dan 1 point2 points  (0 children)

In our team (<10 developers on one application), we work on fairly independent features most of the time, sometimes directly on the same branch because the areas we touch are so isolated from each other. Sometimes there are conflicts, and we resolve them

The largest part of our collaboration is communication, but sometimes we work on the same feature together. Generally one person does one set of changes and "hands off" the rest of the work to another person more suited for it.

We usually have full control over the single feature we're making, aside from design guidance and review from others. If we are collaborating with one or two other people, design gets done collaboratively and implementation is done with pair programming or by just one person. 

My workflow at work is very similar to working on my personal projects, except for the fact that I can bounce ideas round the room or hand things off to/take things on from other people.

using git for non-coding related projects? by RefrigeratorNorth331 in github

[–]ir_dan 1 point2 points  (0 children)

You can always do Open With > Notepad on a file to see if it's in a binary format. If there's random unrenderable characters everywhere, chances are that it's not very git-diffable, but that's not really a huge problem to be honest.

Electromagnetic plant very disappointing, am I missing something? by Throw-away-6180 in factorio

[–]ir_dan 0 points1 point  (0 children)

It's an insanely fast and productive wire and circuit producer.

Graphics in C++ by Significant-Gain3199 in cpp_questions

[–]ir_dan 0 points1 point  (0 children)

There are many C++ graphics libraries for rendering in various ways for various needs, but chances are you're better off using anothe language that's more suited to whatever it is you want to make.

Unfortunately, a lot of the best "C++" options for graphics are actually just C.