I rather write garage code than using slop

you are viewing a single comment's thread
view the rest of the comments
[–] 6 points 7 hours ago (6 children)

I very strongly disagree. It's practically a superset for backwards compatibility reasons but modern C++ coding patterns are vastly different to C. Modern English is kind of a superset of Shakespearean English, but you don't need to know it for most daily tasks. C++ is much more elegant and safe when avoiding C patterns. C has its place and I use it sometimes, but the two should absolutely not get confused because of the name and compatibility.

  • source
  • parent
  • hideshow 6 child comments
  • [–] 1 point 5 hours ago (5 children)

    C++ is a lot of things but elegant and safe are not words that come to mind. C++ has far more issues than regular C.

    Best option would be to use something with memory safety

  • source
  • parent
  • hideshow 5 child comments
  • [–] 2 points 4 hours ago (2 children)

    Well, I mentioned safe in the comparative degree. Modern C++ could be actually safe if you restrict yourself to a subset of it, that's sometimes not really practical. I do think that things are improving and with C++26 it's becoming way easier to write perfectly (memory-)safe code that's also (subjectively) elegant.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 3 hours ago (1 child)

    The C++ spec is absolutely massive. Nothing says elegant like a million different ways to do something.

    Python works pretty well and doesn't have to much overhead. Sure it doesn't have the same performance as C/C++ or Rust but most of the time you don't need millisecond level code.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 1 point 3 hours ago (1 child)

    Modern C++ changed a lot!

    You are supposed to use shared_ptr (automatic reference counted pointer) and unique_ptr(statically checked unique pointer) and not create raw C-style pointers anymore. It still has a lot of weird niche cases that need to be avoided, but memory management is definitely much easier, so in many ways it's safer at runtime than C, while being still much more obscure than C.

    I still agree with you that a more modern language would be even better, especially for learning!

  • source
  • parent
  • hideshow 1 child comment