unknownuserunknownlocation

  • 1 Post
  • 44 Comments
Joined 1 year ago
cake
Cake day: August 1st, 2025

help-circle



  • Honestly, I’m glad to have them, it can make a number of things simpler. For instance, a program I wrote had a number of duration fields that had to be stored in XML files and updated every once in a while. It was something that had to occur very often in the code: add a value to the duration, set that value in the XML data, and save the XML file. So I created a class that stored the date/time value and a pointer the XML element (it could be assumed that nothing else would be changing the value in the XML file and if it did, then that change should be overwritten) and overloaded the += operator (among others), so then all I needed was to create the DurationField object, and then I could go durationFieldX += time2 - time1 for instance. I could abstract all the logic away and make it very clear and easy to write. Could I have made it so that I have to to durationFieldX.add(time2 - time1)? Of course I could have. But IMO that variant is less neat and less readable.





  • Agree on that. It cuts both ways. On the one hand, it gives you access to a fuckton of libraries so that you can chose the one that best fits your use case. On the other hand a lot of those libraries don’t use modern C++. And I haven’t even started on things like the win32 API, which is essentially a C library masquerading as a C++ API.

    That’s essentially the thing with C++: when you’re chosing which library to use, the level of C++ should be a factor in the decision making process, along with things like performance and functionality. And if I do end up using a library that was written for an old C++ version, I create wrappers for the things I use the most to bring it to the level of C++ I’m working with. Sometimes it’s also interesting purely from a learning perspective. That’s what I did for a lot of the win32 APIs I worked with.

    You mentioned tutorials - I learned C++ from learncpp.com, and I couldn’t recommend it more. It does a really good job at going deep into the technical stuff, but also understanding and using the most modern features of the language, as well as best practices.









  • Let’s set some things straight, opinions aside.

    Capitalism is simply the concept of production being run privately, with supply and demand regulating the market.

    Productivity is a measure of how much is created with a specific amount of input. As long as the technology moves forward, productivity usually increases as well. If a new technology allows 9 people to do what was previously the work of 10, you’ve increased productivity in that sector.

    Inflation is the increase of prices. Ideally, it’s supposed to broadly reflect the increase of productivity. A small amount of inflation (usually around 2%/year) acts as an investment incentive, since hoarding money makes you effectively slowly lose it, because it loses its value over time, so instead you’re coaxed into investing it into companies/whatever whose value at least keep up with inflation. If you invest well, the value of whatever you invest it in grows larger than inflation, in which case you’ve increased the value of what you’ve invested. If you invest poorly, the value increases less than the rate of inflation, or even decreases, in both cases you’ve lost value.

    A company that doesn’t grow or shrink from a production perspective generally will keep up with inflation. An economy is generally measured with the GDP (Gross Domestic Product, a measure of how much is produced, valued in a currency), and similarly, since it’s also measured in currency, if the economy grows at the rate of inflation and there’s no productivity gain, the amount produced will stay the same.

    Emissions don’t have to be coupled with growth. A growing economy that progressively switches to renewables at a fast enough pace can still grow while reducing emissions. In fact, the primary reason why emissions keep rising despite capitalism generally dealing with issue of limited resources is that emissions generally aren’t counted as resources, since there are no or not enough costs associated with them (read: externalization of costs). This is the reason why economists repeatedly tout carbon pricing as one of the most effective methods of carbon emission reductions. If companies are forced to factor in emissions costs the way they do every other resource (like working hours, materials, etc.), they will be much more incentivized to do so, since it directly affects their bottom line. Progressively increasing carbon costs could very well lead to the near elimination of carbon emissions. Carbon pricing, however, has not been anywhere rigorous enough to lead to this outcome.

    Now that we’ve gotten some facts straight, let the discussion continue.