[–] 4 points 9 months ago

The way I make it work is -fno-exceptions (or, alternatively, loading up a simile to ned14's error system).

One of the highlights of the article is that it does do explain how the C++ system allows you to throw anything, even with a meme for the occasion.

  • source
  • [–] 6 points 9 months ago

    why the industry is still not ready to move away from it.

    But why should the industry move away from it?

    Am i the only person on earth who doesn't think C++ is a liability and actuallly works faster in it?

    At work i have to develop a backend api in TypeScript and it severly lacks in features compared to C++, again maybe its just me but i don't find how one is expected to magically program faster in TypeScript then C++.

    Not to mention the idiocy of compiling a static typed language to a dynamic typed language which is then interpreted.

  • source
  • [–] 1 point 10 months ago (1 child)

    Of course. I've programmed in C++ for some twenty years at this point, and I'm still effectively writing C with classes (plus a few bits and bobs, as appropriate). I'm just at the point where I think this pig has so many layers of makeup applied that it's starting to cake off in massive chunks.

  • source
  • parent
  • context
  • [–] 3 points 10 months ago (2 children)

    Very few... But it's honestly OK, you don't need to know everything to be a C++ dev. There's a few key features and practices you can't ignore, and the rest can be discovered by staying informed whenever you have time and by reading cppreference when you see things that are unfamiliar in the codebases you're working on.

  • source
  • parent
  • context
  • [–] 3 points 1 year ago*

    .(starts|ends)_with

    Annoying because they are methods, which means you can't backport them. Free functions are jst universally better. Then again, didn't really miss these two in particular very much because PCRE exists, and if you are already doing any significant text or math processing in your program, one regex is not much of an issue (the composable nature of text processing is such that adding the regex for starts/ends with is likely exact zero extra cost; some part of your system might already have been doing it before).

    Unordered Erase

    Okay, color me surprised here but I though we had gotten this one in C++20 or C++23 as part of the previously Experimentals? At least I seem to remembered an unordered something, but I can't recall if it was erase or not.

    Early Return

    This is one of the big use cases why I still use goto. Lead on with the important parts of the functions first, leave the specifics of why you can't/couldn't do it for later (goto), after (exceptions) or before (expected, result types, etc).

  • source
  • [–] 2 points 1 year ago

    After few years in programming I can attest that "Write Self-Documenting Code" doesn't hold. No matter how much coder thinks their code is self explanatory.
    An addition of nice, concise, and blunt comment on critical points in function saves heads (and brains) of whoever comes next.
    Writing comments is cheaper in long run, than any clever variable/function naming. (note: I'm not saying that names should be abstract, but by them self are not enough to make code user frendly).

  • source
  • [–] [S] 0 points 1 year ago

    First: it's not new, it's been around since C++03.

    Second... it's not even that great. It's more characters to type and you have to deal with stds and colons. (void) is a classic and works everywhere.

    But hey, at least it's not static_cast<void>(...).

  • source
  • parent
  • context
  • view more: ‹ prev next ›