Stories
Slash Boxes
Comments

SoylentNews is people

posted by Fnord666 on Monday October 28 2019, @06:05AM   Printer-friendly
from the evolve-or-die dept.

C++ is a language you should give serious consideration to learning in 2019 (or whenever you happen to come across this article). Rapid language modernization, better tooling, a growing and inclusive community, and a thriving job market are just some of the reasons C++ should be your next language to learn.

Wow, this guy drank too much Kool-Aid ™️️, I'm out.

Yeah, I get it. At least in the communities I've been a part of over the years, C++ has a consistently bad reputation.

...

Modern C++ (versions ≥ 11) is an entirely different beast and should be considered separately.

foreach new_shiny in hackerland
    { import; improve; integrate; }

Plus, importing crusty old code into your projects is fun, well, at least more fun than dissecting them and re-coding in a new language which lacks the libraries they leaned on.


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 5, Insightful) by exaeta on Monday October 28 2019, @06:42AM (22 children)

    by exaeta (6957) on Monday October 28 2019, @06:42AM (#912679) Homepage Journal
    Honestly, other langauges are just generally a headache to program in. C++ does offer some challenges, but it solves all problems. I've never met a problem C++ can't solve. No other language, not even C, has that kind of power and versatility. C++ can do anything well, and that is what sets it apart from other flawed langauges like C, Java, and Python. Versatility and power. Other languages have stuff they simply don't do well. But in the hands of an expert, C++ can do anything, and do it well.
    --
    The Government is a Bird
    Starting Score:    1  point
    Moderation   +3  
       Insightful=3, Disagree=1, Total=4
    Extra 'Insightful' Modifier   0  
    Karma-Bonus Modifier   +1  

    Total Score:   5  
  • (Score: 5, Insightful) by coolgopher on Monday October 28 2019, @07:09AM (7 children)

    by coolgopher (1157) on Monday October 28 2019, @07:09AM (#912690)

    Try doing client-side scripting for an SPA in C++ and then tell me it's good for /everything/. Wt [webtoolkit.eu] simply does not stack up against something like React [reactjs.org] in that domain.

    C++ is probably my favourite tool/language, but it's not the universal answer.

    • (Score: 0) by Anonymous Coward on Monday October 28 2019, @02:36PM (1 child)

      by Anonymous Coward on Monday October 28 2019, @02:36PM (#912808)

      Client-side scripting in the web browser is, by definition, restricted to code that can run in the web browser, which forces javascript.

      C++ could easily solve whatever problem you have by eliminating the need for client-side scripting, replacing it with a server-side FastCGI software. Or you could write a non-browser client for the service, in C++ .

      • (Score: 2) by Immerman on Tuesday October 29 2019, @12:30AM

        by Immerman (3985) on Tuesday October 29 2019, @12:30AM (#913049)

        Unless your problem involves remaining responsive when the user has 5-second ping times...

    • (Score: 2, Insightful) by Anonymous Coward on Monday October 28 2019, @03:34PM (2 children)

      by Anonymous Coward on Monday October 28 2019, @03:34PM (#912838)

      Wow, talk about creating a strawman argument. Find a niche specifically not for C++ and yell, "see, it's no go!" Moron.

      • (Score: 3, Interesting) by coolgopher on Tuesday October 29 2019, @12:51AM (1 child)

        by coolgopher (1157) on Tuesday October 29 2019, @12:51AM (#913060)

        You haven't actually looked at Wt, have you? It's pretty good, and means all the horrible JS is abstracted away from you and you can stick to writing type safe C++. It'd be interesting if someone wrote a clang backend to target WebASM though...

    • (Score: 2) by JoeMerchant on Tuesday October 29 2019, @04:17PM

      by JoeMerchant (3937) on Tuesday October 29 2019, @04:17PM (#913311)

      Wt died on the vine, and more's the shame - it had such potential.

      --
      🌻🌻 [google.com]
    • (Score: 2) by exaeta on Wednesday October 30 2019, @08:33PM

      by exaeta (6957) on Wednesday October 30 2019, @08:33PM (#913863) Homepage Journal
      It does it pretty well, since most JavaScript interpreters are written in C++.
      --
      The Government is a Bird
  • (Score: 3, Funny) by c0lo on Monday October 28 2019, @07:10AM (5 children)

    by c0lo (156) Subscriber Badge on Monday October 28 2019, @07:10AM (#912692) Journal

    I've never met a problem C++ can't solve.

    Here's one problem that C++ will never solve: driving the C++ compilation time from geological or even astronomical time back to human-life scales [xkcd.com].

    --
    https://www.youtube.com/watch?v=aoFiw2jMy-0 https://soylentnews.org/~MichaelDavidCrawford
    • (Score: 0) by Anonymous Coward on Monday October 28 2019, @01:45PM

      by Anonymous Coward on Monday October 28 2019, @01:45PM (#912784)

      Wow, it's been a while since I followed an XKCD link here and didn't know what I was going to see once I got there.

    • (Score: 2) by maxwell demon on Monday October 28 2019, @02:16PM (2 children)

      by maxwell demon (1608) on Monday October 28 2019, @02:16PM (#912798) Journal

      You are aware of C++ modules?

      --
      The Tao of math: The numbers you can count are not the real numbers.
      • (Score: 2) by c0lo on Monday October 28 2019, @07:39PM

        by c0lo (156) Subscriber Badge on Monday October 28 2019, @07:39PM (#912925) Journal

        I know that's in discussion, but there's no warranty that will be a foolproof solution.

        --
        https://www.youtube.com/watch?v=aoFiw2jMy-0 https://soylentnews.org/~MichaelDavidCrawford
      • (Score: 2) by chromas on Tuesday October 29 2019, @02:42AM

        by chromas (34) Subscriber Badge on Tuesday October 29 2019, @02:42AM (#913102) Journal

        Let's give a round of applause to C++ for catching up to the 1970s. :D

    • (Score: 2, Funny) by Anonymous Coward on Tuesday October 29 2019, @07:22AM

      by Anonymous Coward on Tuesday October 29 2019, @07:22AM (#913170)

      Long compile times have been a benefit and feature to programmers for a long time. Programmers wrote compilers with the benefits and features they wanted. Not surprising that compilers would be written to have long compile times.

  • (Score: 2) by darkfeline on Monday October 28 2019, @07:33AM (3 children)

    by darkfeline (1030) on Monday October 28 2019, @07:33AM (#912698) Homepage

    >in the hands of an expert, C++ can do anything, and do it well.

    That's an interesting hypothesis, but not very practical given that no one, not even any one of its creators, can be considered a C++ expert since they do not know 100% of the language spec and all interactions thereof.

    --
    Join the SDF Public Access UNIX System today!
    • (Score: 2) by c0lo on Monday October 28 2019, @08:29AM

      by c0lo (156) Subscriber Badge on Monday October 28 2019, @08:29AM (#912711) Journal

      That's an interesting hypothesis, but not very practical given that no one, not even any one of its creators, can be considered a C++ expert since they do not know 100% of the language spec and all interactions thereof.

      Besides "expert knowledge" is necessary but insufficient for "expert use".

      --
      https://www.youtube.com/watch?v=aoFiw2jMy-0 https://soylentnews.org/~MichaelDavidCrawford
    • (Score: 2) by vux984 on Monday October 28 2019, @06:46PM

      by vux984 (5045) on Monday October 28 2019, @06:46PM (#912915)

      "not even any one of its creators, can be considered a C++ expert since they do not know 100% of the language spec and all interactions thereof."

      That's a pretty strange definition of 'expert'. Where else does expertise in a subject require 100% knowledge of subject matter and all possible interactions?

    • (Score: 2) by exaeta on Wednesday October 30 2019, @08:37PM

      by exaeta (6957) on Wednesday October 30 2019, @08:37PM (#913865) Homepage Journal
      No chemistry expert knows everything about chemistry. We should not expect any different from C++ experts either. The fact you can know all of C demonstrates its triviality.
      --
      The Government is a Bird
  • (Score: 2) by DannyB on Monday October 28 2019, @01:20PM

    by DannyB (5839) Subscriber Badge on Monday October 28 2019, @01:20PM (#912774) Journal

    Honestly, other langauges are just generally a headache to program in. C++ does offer some challenges, but it solves all problems. I've never met a problem C++ can't solve.

    Honestly, other langauges are just generally a headache to program in. Brainfuck [wikipedia.org] does offer some challenges, but it solves all problems. I've never met a problem Brainfuck can't solve.

    Some idiot once said:

    Use the right tool for the right job.

    There is no perfect language for all purposes, or we would all be using it already.

    If your only hammer is C++ then every problem begins to look like a thumb.

    --
    People today are educated enough to repeat what they are taught but not to question what they are taught.
  • (Score: 2) by HiThere on Monday October 28 2019, @05:51PM (2 children)

    by HiThere (866) Subscriber Badge on Monday October 28 2019, @05:51PM (#912899) Journal

    If you already know C++ well enough, you can use it for almost anything. (Well, it still doesn't understand directories on disk, but that's coming.) The problem is it's a lot more complex than ADA ever was, and doesn't have the security.

    FWIW, *any* Turing complete language can do anything that any of the others can. In principle. But there was a reason that languages like, e.g., SNOBOL were developed. C++ is an excellent tool for many languages that C isn't that great for, and conversely. And if you use C++ where you should use Python, you're taking lots of extra time and making things hard for yourself to no gain. (When the limiting factor is user response time, "fast enough" can't be improved on.)

    And there are problems for which no existing language is optimally designed. For one that I'm looking at byte aligned structs would be really desirable, but I also want decent handling of unicode strings, message passing parallel processing on a dynamic grid of destinations, concurrency AND parallelism, immutable structs, user defined types, decent documentation that emits static html pages (or some word processor equivalent), etc. I'm currently building a toy version in Python, and expect to need to translate that to Go at some point for the easy concurrency with faster processing. But Go doesn't have a decent screen drawing library yet. The best I've found so far is tkinter. (It currently seems better than qt, wx, or swing for my purposes). (Go does have tk libraries, but they look beta and, if the documentation is to be trusted, are not feature complete enough.)

    But this all COULD be done in C++. Probably even C, though I'm not sure about the message passing concurrency without using RAM based emulations of disk files. But handling unicode in C++ is not easy. It's doable, but I'd have to write the code rather than using a decent library (and I'd still need to use an external library, just one that wasn't feature complete).

    --
    Javascript is what you use to allow unknown third parties to run software you have no idea about on your computer.
    • (Score: 2) by exaeta on Wednesday October 30 2019, @08:45PM (1 child)

      by exaeta (6957) on Wednesday October 30 2019, @08:45PM (#913869) Homepage Journal

      The point isn't about libraries, but what the core language is capable of. Unicode is just more libraries that need to be written. The core language handles text processing just fine.

      Java is unsuitable for realtime work. There is no way to get around that with a library or writing more code. The garbage collector makes it unusable. Go is unsuitable for DOS resistance. Garbage collector again. JavaScript, python, etc. is unsuitable if you need maximum performance. C is unsuitable if you need to do something complicated in a secure way. C++ can handle secure, high performance, complicated projects just fine. There is no niche it can't fill. C++ doesn't hand everything to you on a plate, but it can still do it if you write the correct code. No other language can fill all these different niches.

      Actually I need to correct myself. There is one area that C++ cannot handle, and that is the GPU. You need GLSL or DirectX shader language for that... Vulkan+LLVM may change this though!

      --
      The Government is a Bird
      • (Score: 2) by exaeta on Wednesday October 30 2019, @09:56PM

        by exaeta (6957) on Wednesday October 30 2019, @09:56PM (#913896) Homepage Journal
        ps: C++ already understands directories, std::filesystem...
        --
        The Government is a Bird