News for hackers. Stuff that matters.
Re:Does C++ still deserve a bad rap? by beyondCritics on Friday October 16, 2020 @10:54PM (#24807105)
C does destructive conversions automatically, if you ask for it. E.g.

  unsigned n;
  n = 2.99;      // n = 2
  n = -1;        // n = 2^M-1;
  n = 1.0E33;    // undefined but not catched
Both C and C++ follow the same philosopy: "Trust the programmer". The programmer is expected to use his expressive freedom, to solve performance problems and stay away from problematic constructs without being told to so. C is a systems programming language from the 70's, designed to solve performance problems and C++ inherits from that. It is true, that in C++, you can overload assignment, addition and throw exceptions everywhere, thus making even simple expressions like

  auto n = a + b;
completely unpredictable. But the coder simply has abused the freedom C++ gave him. T some extent, the same is possible in C, look here https://www.ioccc.org/
Re:Does C++ still deserve a bad rap? by beyondCritics on Friday October 16, 2020 @11:16PM (#24807191)
Either you love C++ or you hate it. To tell the truth, i am also of the opinion that C++ is fucking crazy complicated. There are youtube videos from leading experts, explaining the usage of simple language elements at length, something like that is unheard of in modern languages. E.g. you are not expected to grasp overload resolution to the fullest extent: https://en.cppreference.com/w/cpp/language/overload_resoluti... Mastery takes likely years of experience.
Re:Does C++ still deserve a bad rap? by pooya13 on Saturday October 17, 2020 @04:32AM (#24808443)
> Both C and C++ follow the same philosopy: "Trust the programmer"

I disagree. I think ever since it’s inception from C, C++ has tried to increase type safety and continuously move more of the work to the compiler (latest example is concepts). It does empower the programmer to do what they want: OOP, FP, GP...

The philosophy of the language is mostly about abstractions. Abstracting objects, types, resource management etc And using modern C++ features and a recent compiler makes it harder to make mistakes. Using some generally accepted guidelines and static analysis tools helps even further.

Though the syntax is at times ugly due to the age of the language and it has a lot of inertia that makes it hard to get rid of some bad design decisions like some of the defaults, unless someone recreates c++ with the same flexibility and power, and the same powerful compilers/tools but with better syntax and defaults I don’t see the language going anywhere. And I am not holding my breath for another language to quickly be able to reproduce the C++ echo system that have taken decades to develop.

Re:Does C++ still deserve a bad rap? by srg0 on Saturday October 17, 2020 @02:13PM (#24811929)
The philosophy of C++ is about _zero cost_ abstractions.