Slashdot Mirror


Why ESR Hates C++, Respects Java, and Thinks Go (But Not Rust) Will Replace C (ibiblio.org)

Open source guru Eric S. Raymond followed up his post on alternatives to C by explaining why he won't touch C++ any more, calling the story "a launch point for a disquisition on the economics of computer-language design, why some truly unfortunate choices got made and baked into our infrastructure, and how we're probably going to fix them." My problem with [C++] is that it piles complexity on complexity upon chrome upon gingerbread in an attempt to address problems that cannot actually be solved because the foundational abstractions are leaky. It's all very well to say "well, don't do that" about things like bare pointers, and for small-scale single-developer projects (like my eqn upgrade) it is realistic to expect the discipline can be enforced. Not so on projects with larger scale or multiple devs at varying skill levels (the case I normally deal with)... C is flawed, but it does have one immensely valuable property that C++ didn't keep -- if you can mentally model the hardware it's running on, you can easily see all the way down. If C++ had actually eliminated C's flaws (that is, been type-safe and memory-safe) giving away that transparency might be a trade worth making. As it is, nope.
He calls Java a better attempt at fixing C's leaky abstractions, but believes it "left a huge hole in the options for systems programming that wouldn't be properly addressed for another 15 years, until Rust and Go." He delves into a history of programming languages, touching on Lisp, Python, and programmer-centric languages (versus machine-centric languages), identifying one of the biggest differentiators as "the presence or absence of automatic memory management." Falling machine-resource costs led to the rise of scripting languages and Node.js, but Raymond still sees Rust and Go as a response to the increasing scale of projects.
Eventually we will have garbage collection techniques with low enough latency overhead to be usable in kernels and low-level firmware, and those will ship in language implementations. Those are the languages that will truly end C's long reign. There are broad hints in the working papers from the Go development group that they're headed in this direction... Sorry, Rustaceans -- you've got a plausible future in kernels and deep firmware, but too many strikes against you to beat Go over most of C's range. No garbage collection, plus Rust is a harder transition from C because of the borrow checker, plus the standardized part of the API is still seriously incomplete (where's my select(2), again?).

The only consolation you get, if it is one, is that the C++ fans are screwed worse than you are. At least Rust has a real prospect of dramatically lowering downstream defect rates relative to C anywhere it's not crowded out by Go; C++ doesn't have that.

608 comments

  1. This seems to reinforce how clueless he is by Anonymous Coward · · Score: 3, Insightful

    He seems to think he has some great insight into why C is C, why C++ is C++. But really, he is so fucking clueless I don't know where to start.

    1. Re:This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      He doesn't have the necessary clue because he suffered the C++-trauma of the 2003 style of C++. There is really no saving him to see the light until 2020 at the earliest. If all goes well.

    2. Re:This seems to reinforce how clueless he is by Anonymous Coward · · Score: 1

      He seems to think he has some great insight into why C is C, why C++ is C++. But really, he is so fucking clueless I don't know where to start.

      He's one of many crazy ones that look for :

      The One True Language
      One language to rule them all, One language to find them, One language to bring them all, and in the darkness bind them, In the Land of Microsft/Google/Apple/Facebook where the Shadows lie.

    3. Re:This seems to reinforce how clueless he is by e70838 · · Score: 2, Interesting

      I have studied deeply C++98. I try to avoid C++ and favor Java each time I can. I am programming since 1994 and I agree with every single word ESR said. I do not know if rust or go are the future. I think we can do better and that there are a lot of insight to get from Ada (and ravenscar).

    4. Re:This seems to reinforce how clueless he is by Anonymous Coward · · Score: 1, Interesting

      He seems to think C is in need of replacement. It is not. Memory management is not hard - and pointers is not a problem. Well, perhaps some lesser programmers have problems with those - nice that there are other languages for them then.

      C++? Nice to have if you want object-orientation built-in. The language may have some flaws - but it is always best to not use each and every feature of some language anyway.

      Java? It is a pain. And I am not referring to garbage collection pauses. If you choose Java, it is because you buy into garbage collection. I have come up against so many other limitations just using java to teach programming:
      * What, I can't spend more than 2GB? Oh, maybe it is possible, but I need to jump through hoops for that? C/C++ gives me an 8GB array if I declare it. Java won't give me that amount of memory - neither in a single allocation nor in smaller chunks.
      * Slow file i/o. Try writing a simple 'file copy' in java, and copy 50GB. Compare to 'cp'. Java has improved lately, but you must be very careful selecting classes/methods.
      * Slow string handling. Parsing 100MB of text is slower than reading it in from disk, or even downloading it over the net. Unless you write it all yourself. So much for supplied methods.
      * Lack of types. Everything is signed except 'character' which is 16 bit unsigned. Makes data compression & crypto unnecessarily kludgey.
      * Lack of io capabilities. Try writing an array of "long" to a file - can you do it without an iterating loop & slow i/o? C can fwrite() any chunk of memory.

    5. Re:This seems to reinforce how clueless he is by Hal_Porter · · Score: 3, Funny

      People that met him claim he has halitosis too. That's what happens to people who oppose the C/C++ binarchy. Their heresy festers inside them, causes severe halitosis and they are driven out of society to live in the mountains. Where, from the look of him, ESR is headed.

      Praise Kernighan, Ritchie and Stroustrup! Death to the heretic ESR!

      --
      echo -e 'global _start\n _start:\n mov eax, 2\n int 80h\n jmp _start' > a.asm; nasm a.asm -f elf; ld a.o -o a;
    6. Re:This seems to reinforce how clueless he is by Anonymous Coward · · Score: 1

      My experience is that C++ have the bad things from both C and Ada combined.

      And as soon as you try to write qualified stuff in C++ it will be code that's hard to maintain and understand compared to many other languages.

    7. Re:This seems to reinforce how clueless he is by jcr · · Score: 1

      He's right about C++, though.

      -jcr

      --
      The only title of honor that a tyrant can grant is "Enemy of the State."
    8. Re: This seems to reinforce how clueless he is by arglebargle_xiv · · Score: 0

      Can someone you this?

      Poland cannot.

    9. Re:This seems to reinforce how clueless he is by jcr · · Score: 4, Insightful

      He seems to think C is in need of replacement. It is not.

      Some of us care about security, and C suffers from a lack of strings or arrays*, making buffer overflows a way of life. This needs to be remedied, and "just don't do that" isn't a remedy.

      -jcr

      * C has pointers and some syntactic camouflage that makes them appear to be strings or arrays. Don't be suckered.

      --
      The only title of honor that a tyrant can grant is "Enemy of the State."
    10. Re: This seems to reinforce how clueless he is by Anonymous Coward · · Score: 1

      Writing code in c is not hard for good programmers, as of yet we have failed to find them. Hence the need for better languages.

      Check out the recent Bluetooth exploits for instance, the majority would be impossible in "safe" code.

    11. Re: This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      A good programmer is not necessarily one good at statistics BTW. It doesn't matter how few bugs you can get down to, It's about how much impact they make.

      No one is perfect, if one buffer overflow or use after free costs a billion dollars you're doing it wrong if you use C(++).

    12. Re:This seems to reinforce how clueless he is by ThosLives · · Score: 3, Informative

      If you are doing things in which you need to be sure about security and/or safety you should be using static and dynamic tests and checks, which would find most of those issues with pointers and arrays. You should do those things even with a managed language.

      Also, I would much prefer a language that allows me low level things (there is no reason you cannot implement a Pascal-style string in C, for instance) instead of forcing some restricted choice of operations decided by the language or library committees.

      As for garbage collection - if you are really into security or safety, the most robust approach is to have no dynamic memory allocation at all. But when dynamic memory allocation is required, it really would be nice if deterministic (in both runtime and time-of-run) garbage collectors were available.

      --
      "There are a dozen opinions on a matter until you know the truth. Then there is only one." - CS Lewis (paraprhase)
    13. Re:This seems to reinforce how clueless he is by Anonymous Coward · · Score: 2, Insightful

      So create an opaque data structure and a collection of methods to manage the structure with methods for inserting, removing, resizing, etc., bundle it up into a library and you're done. That is, after all, what a C++ class is, a data structure with supporting methods. I've actually done similar in Java with the primitive data types (int, float, etc) because I don't want to us ArrayList and have to auto-box each type into an object. Simple class with an int[] data element and a few add, retrieve methods.

    14. Re:This seems to reinforce how clueless he is by Bing+Tsher+E · · Score: 1

      ESR just comes out of the mountains every once in awhile with a stone tablet that we're all supposed to read.

    15. Re:This seems to reinforce how clueless he is by lucasnate1 · · Score: 4, Interesting

      The C standard doesn't prevent anyone from implementing a calling convention where there's a separate stack for parameters and return addresses. That alone would solve many security problems.

    16. Re: This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      "Can someone you this?"

      That's quite some crammer this morning, Chris!

    17. Re: This seems to reinforce how clueless he is by reanjr · · Score: 1

      Perhaps not, but C's standard calling convention is what makes it interoperable with so much other software. You write yourself into the C ghetto by changing the calling conventions.

    18. Re: This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      If your experience of C++ is C++98, then that explains your issue, try any of the C++1{1,4,7} variants and youâ(TM)ll see that things have improved dramatically.

      Iâ(TM)d happily take modern C++ any day over Java. But then a lot of my issue there is that I do things that are time sensitive, so garbage collection is just a non starter.

    19. Re: This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      If you think that memory management is not hard then you need to take a look at the massive number of security issues out there, most of which are memory management issues. You then need to ask âoeif this is not hard, why does everyone fuck it up so much?@

    20. Re: This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      C++98 is around 20 years old now. There have been numerous significant revisions since then. Yet you still base your analysis on your very outdated and irrelevant knowledge of C++.

      It's exactly the same as using Debian 2.0 and the 2.1 Linux kernel, both from 1998, to judge the suitability of GNU/Linux today, 20 years later, despite both seeing massive changes since then.

      You know how stupid it would be to judge GNU/Linux in that way, so why the hell do you apply the same stupid judgment approach to C++?!

      If you're judging C++ today based on what it was 20 years ago, then you're an idiot.

    21. Re: This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      I'll tell you why rust has a huge reddit following (probably applies to HN as well), the circlejerk. Spend any reasonable time on there in programming related subs and you'll see.

    22. Re:This seems to reinforce how clueless he is by david_thornley · · Score: 3, Informative

      I have studied deeply C++98.

      I can understand why you'd prefer Java. C++11 and the following standards make it a much different and easier-to-use language.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    23. Re: This seems to reinforce how clueless he is by Miamicanes · · Score: 2

      Java's continued lack of an unsigned primitive 8-bit byte type is just inexcusable. It makes doing anything that involves binding with C++ (e.g., OpenGL ES) *excruciatingly* painful.

      I would love to meet one person... ONE... who has EVER thought, "I'm *so* thankful Java's primitive bytes are signed instead of unsigned. That was a bold, awesome design decision."

      If Java had an 'octet' type of unsigned 8-bit values, my life would have been IMMEASURABLY easier over the past 20 years, and I would have been spared weeks of troubleshooting insidious bugs that happened because I forgot a "&0xff" somewhere (or accidentally put it on the wrong side of parentheses).

    24. Re:This seems to reinforce how clueless he is by robkeeney · · Score: 1

      "Well, perhaps some lesser programmers have problems with those" and that's the problem ESR is grappling with-- most programmers are lesser programmers. Far too many people who write software shouldn't be allowed anywhere near a computer. ESR's solution to this is a dumb language that prevents code grinders from doing the wrong thing. That's why he's adamantly against C++. He thinks it's too easy for the monkeys he deals with to write reams of trash. What he doesn't realize is that the monkeys he works with are going to write reams of trash no matter what language he gives them.

    25. Re:This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      C++11 and the following standards make it a much different and easier-to-use language.

      Now if only it being easier to use made it suck less...Even if it's easier, it's still a mess of a language built on a foundation of sand. It's very obvious why people who have sunk less time into C++ would be so willing to abandon it for things like Rust or Go. Honestly at this point the only people really hanging on to C++ are those that have sunk-cost fallacy or large codebases that should be switched to a better language anyway.

    26. Re:This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      Some of us care about security, and C suffers from a lack of strings or arrays*, making buffer overflows a way of life.

      Some of us care about small binaries, tight code, high performance, and the ability to program directly against the hardware.

      I've personally written from the metal up the controlling of a hard drive, an implementation of the FAT filesystem on top of that, and I've written task switchers against x86 hardware. I'm not interested in something which makes it safe at the expense of performance.

      C isn't suitable for every task, or you need to write your own stuff.

      But please, don't disparage a programming language which is meant for big boys to solve difficult problems. Your need to have security for your shitty web application has nothing to do with the actual strengths of C.

      C does have arrays ... it just doesn't give you training wheels, a helmet, and lace fucking doilies to make it look pretty. But where it is most useful is for writing operating system type code or other stuff where you're not sanitizing the inputs provided by morons.

      There's a reason operating systems are mostly written in C.

    27. Re:This seems to reinforce how clueless he is by nomadic · · Score: 1

      ESR is kind of famous for not being, on a technical level, a very good programmer.

    28. Re: This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      Complains about people commenting on c++98. Then immediately talks about Java shortcomings from the 32 bit era.

      This entire thread has convinced me that nobody on /. Is qualified to talk about both c++ and Java. I certainly am not. But at least I am smart enough to realize it.

    29. Re: This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      Yeah, and there's also a problem with C/C++ coders thinking they're infalliable coding gods, so they refuse to switch because "good coders don't need that stuff"

      Actual good coders recognize a problem and use quality tools to fix it. I can understand not wanting to use GC (because no matter what ESR thinks GC will always result in additional used resources which not every task can tolerate). There are plenty of languages out there that have proven themselves and would be better to use for security purposes, and good FFI means you could still use C/C++ for the speed critical parts. And with Rust there's not even much excuse on the speed side anymore.

      Good programmers will let the computer do what the computer is good at. Bad programmers say they're so good they don't need any of that stuff.

    30. Re: This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      > I would love to meet one person... ONE... who has EVER thought, "I'm *so* thankful Java's primitive bytes are signed instead of unsigned. That was a bold, awesome design decision."

      That idea took a lot of courage!!!

      Same with the idea that numeric types aren't objects, that's a big hole in the language.

    31. Re:This seems to reinforce how clueless he is by HornWumpus · · Score: 1

      SEMICOLON to that brother. We must burn the witch!

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    32. Re:This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      Not jcr but I'll give a crack at it:

      1) It's pretty good, needs some maturation time though.

      2) The CoC is silly and should be revised to "Don't be an asshole. We accept all coders"

      3) Don't know many of them, those I've seen are pleasant

      4) Forced diversity is always bad. It tries to treat the symptom without understanding where the actual problem lies.Much like the CoC, the part that a language should be encouraging is the language itself regardless of who is using it. Help those who need help, who cares what they have between their legs or the color of their skin, or their ideologies, or what they do behind closed doors with consenting adults. By trying to elevate those that are "under represented" you appear more hostile toward people who are also just trying to learn and that runs counter to the goal of more people writing code.

      5) Rust's future is in the fact that C++ cannot actually replace Rust's core feature set while still maintaining backward compatibility. C++ would have to be rewritten almost entirely to make the guarantees that Rust does, essentially becoming a new language in the process. As long as C++'s foundation is built on sand, Rust will always have a security advantage.

      6) Slashdot is home of the graybeards who have been indoctrinated so long with "change is bad" because in C/C++ changing working code is a faux pas since bugfixes make more bugs than they fix sometimes. Rust is change, and change is bad, so Rust is bad.

    33. Re:This seems to reinforce how clueless he is by angel'o'sphere · · Score: 1

      That is actually insightful!

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    34. Re: This seems to reinforce how clueless he is by angel'o'sphere · · Score: 1

      That is nonsense.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    35. Re: This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      I've met a C programmer who hated unsigned types and refused to use them - because he didn't like sign errors or casting.

    36. Re: This seems to reinforce how clueless he is by F.Ultra · · Score: 1

      So how do you propose to link with external libraries if you use your own calling convention?

    37. Re: This seems to reinforce how clueless he is by lucasnate1 · · Score: 1

      Roll it gradually as a calling convention through name mangling for compilers that will support it. During transition compile each routine in both calling conventions. This is a bit similar to the old __pascal keyword in MSVC that was meant to support pascal calling convention which was different from C's.

    38. Re:This seems to reinforce how clueless he is by lucasnate1 · · Score: 1

      If I remember correctly, some C compiler for the atari does this because the atari call stack is only 128 bytes.

    39. Re:This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      Ia! Ia! Constexpr for! Printf mingw Constexpr RAII while for!

    40. Re:This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      There's a reason operating systems are mostly written in C.

      Absolutely. It's like, if New York weren't there, where would we put all the New Yorkers? We have to do something with C programmers, may as well put them in a job where they only have to talk to hardware.

    41. Re: This seems to reinforce how clueless he is by swilver · · Score: 1

      Only division (and plain right shift) actually works differently on signed vs unsigned types.

      The Java designers correctly thought that having 1 extra bit so you can store a slightly bigger number was not worth having unsigned types for. Just use a bigger type then.

      It saves millions of Java programmers of having to deal with all the issues that arise when dealing signed and unsigned integer conversion, for example when dealing with float types, which are always signed (but I'm sure there are whiners that want unsigned float types for some obscure reason).

      I've used JNA often enough to interact with C libraries, and having to deal with unsigned stuff is a mere small annoyance when compared to the clumsiness of what C library writers refer to as an "API". Certainly not excruciatingly painful.

    42. Re:This seems to reinforce how clueless he is by angel'o'sphere · · Score: 1

      256 bytes, but that is 128 return adresses.
      6502 CPU.
      Of course you could run your own stack and use your own jump subroutine and return logic, like SWEET16 did.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    43. Re:This seems to reinforce how clueless he is by Hal_Porter · · Score: 1

      It's drifting off topic, but having written a lot of Win32 code and enjoyed how twisted Win32 is this is funny as fuck

      https://arstechnica.com/civis/...

      Win32 makes me feel like I'm stuck trying to converse with some kind of Janus-faced Gogolian bureaucrat monster while filling out endless government forms consisting mostly of unmarked boxes scattered on the page.

      One face of the beast barks terse orders in a fictitious Eastern European language. The other face keeps shouting useless information fragments, like a dementic who reads packaging labels aloud in a futile attempt to remember them for longer than a minute. It sounds like this:

      "CARTONSIZE fgd, Cch! PWSZ lb, HUGEBOXDESCRIPTOR plwd... Plexy_gladsz, LONG LONG pssccht! CANE_SUGAR dwFlag PIKEFISH lodz HALT PWZ_MILK_WHITE_WHITER_EX, da, wctombs."

      --
      echo -e 'global _start\n _start:\n mov eax, 2\n int 80h\n jmp _start' > a.asm; nasm a.asm -f elf; ld a.o -o a;
    44. Re: This seems to reinforce how clueless he is by angel'o'sphere · · Score: 1

      By following the calling convention of the code I call.
      You do know that some calling conventions require you to have an 'empty word' on the stack for the return value?
      Some push arguments from left to right, others from right to left?
      Some use registers.
      Some use arbitrary memory, and pass a pointer to it in a register, or on the stack?
      There are probably a dozen 'common calling conventions' and a few hundret rare ones.
      Register windows come to mind ...

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    45. Re: This seems to reinforce how clueless he is by Tough+Love · · Score: 1

      The Java designers correctly thought that having 1 extra bit so you can store a slightly bigger number was not worth having unsigned types for.

      What is correct about that? It is just typical of the countless doubtful decisions that turned Java into cruel and unusual punishment for systems programmers. Don't take my word for it, just notice that Java's role has devolved to a dumbed down crutch for second tier business programmers. Oh, and Android, too bad about that. Google already paid many times over for that idiotic decision.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    46. Re:This seems to reinforce how clueless he is by Tough+Love · · Score: 1

      that's the problem ESR is grappling with-- most programmers are lesser programmers.

      And ESR is a lesser programmer than he thinks he is, case in point is, he obviously has not been able to learn C++. Maybe he wrote a hello world or something, and now considers himself and expert but his clueless spew speaks louder.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    47. Re:This seems to reinforce how clueless he is by Tough+Love · · Score: 1

      ESR is kind of famous for not being, on a technical level, a very good programmer.

      Right, and he's constantly in search of the best crutch to work around that. More power to him, if he would just keep his mouth shut and take care of his own needs.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    48. Re: This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      Thatâ(TM)s the thing though - still no one has made anything better. The games industry spends huge amounts of time trying to find languages that are safer, easier and faster to work with than C++, while retaining the speed benefits. They never find that language.

      The bottom line is that if you need to write fast code you need to use C++

    49. Re: This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      Sure, C *can fwrite the block of memory, but you shouldnâ(TM)t, because in doing so you make your file writer dependant on your OS, CPU, std lib, and compiler. You have no gaurentees of alignment, size or representation for longs other than âoeitâ(TM)s bigger than 4 bytesâ.

    50. Re:This seems to reinforce how clueless he is by robkeeney · · Score: 1

      Yeah, I left that part out. He had extensive experience with one very large C++ code base (some game) that was, of course, a mess. Not being able to get his brain around it meant the language was obviously the problem. With an ego as large as his, *he* couldn't be the problem, right?

      The thing about C++ (or really any language) is that well-written projects don't tend to need many programmers -- they're easy to maintain and extend -- and thus they don't gather a lot of programmers and don't have large turn-over.

    51. Re: This seems to reinforce how clueless he is by Pseudonym · · Score: 1

      On x86-64 there are two calling conventions: Windows and SysV (used by everything except Windows).

      Non-C languages may do other stuff, but as far as C and C++ are concerned, there are two.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    52. Re: This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      C is full of cheapness. It does Not even support integer exceptions. Neither does it properly initialize pointers nor does it check array Indices.

      You can t specify ranges of variables, which means the safety critical world must use additional semantics such as huge AUTOSAR XML models to capture this.

      These bugs make more than 50â... of the exploits of the CVE database.

      Algol mainframes were much netter than Unix/C. C is merely cheap.

      Pascal and Ada are in many ways much more robust, at least when humans generate code and manage the coder's under commercial constraints.

    53. Re: This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      Rust, Ada, Pascal and Swift are serious competitors to C.

      Surely not Java.

    54. Re: This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      Not at all, for speed there is Fortran.

    55. Re:This seems to reinforce how clueless he is by jcr · · Score: 1

      Never having used Rust nor looked into the people backing it, I really couldn't say.

      -jcr

      --
      The only title of honor that a tyrant can grant is "Enemy of the State."
    56. Re:This seems to reinforce how clueless he is by Altrag · · Score: 1

      A language developer building a dedicated string type into the language with all supporting APIs/libraries is probably going to do a better job of it than everyone rolling their own Pascal-style string implementation.

      C is good when you program is small enough that you can keep it pretty much entirely in your head (at least at an abstract level) and constrained enough that you need fine-grain control over every instruction and optimization.. but that's a tiny, tiny fraction of the programming industry. For everyone else, the cost of programmer time is far more important than saving a few (million) clock cycles or half a gig of RAM.

      Google (and Amazon and similar) are a bit of a strange beast in that they're way too complex for any one programmer to fully comprehend (so you want the derp protection of proper strings and arrays, garbage collection, etc) but at the same time their high performance also requires a level of the fine-grained control (and then throw concurrency issues on top of that, which is a small disaster in pretty much all common languages.) I guess they didn't find one they liked so they invented one.

    57. Re: This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      Initialize and check your own pointers, Goofus. Gallant does it just fine.

    58. Re: This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      Because it's easier to be so careless.

    59. Re: This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      Which begs the question of why you would be running a RISCV binary on an x86 platform and expecting correct results.

    60. Re: This seems to reinforce how clueless he is by alexp700 · · Score: 1

      Definitely a kernel of truth here - 2003 C++ sufferer from very poor compilers that would often fail on complex stuff like stl in hard to fathom ways. The stl is a kind of compiler work out that force them to get it all right. These days the compilers pass the tests and have good handling of user generated errors. C++ can be abused, but most people seem to say âdonâ(TM)tâ(TM) these days about operator overloading, heavy use of multiple inheritance, and generally bending the language in hard to read ways.

    61. Re: This seems to reinforce how clueless he is by angel'o'sphere · · Score: 1

      Two, you know about :D (actually I don't know more either).

      There is no "standard" which asks for those two.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    62. Re:This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      The whole point of a managed language is that you don't have to write all the checks!

      Let's say I'm writing a networked service where I process incoming requests on behalf of clients. Ideally I would parse the requests properly and in the case of invalid requests I would detect it and return an appropriate error. However, there are many, many places that validation has to occur and I may not find them all.

      If I forget to put a bounds check in my C# service, the bad index throws an exception. The result is that a bad request just gets returned an unexpected error, or at worst it crashes the service, depending on how exceptions are handled.

      If I forget to put a bounds check in my C service, there's no guarantee of what will happen. The compiler is free to assume it'll never happen so the behavior is undefined. A user sending a bad request to my service may be able to read my private key or even take control of my whole server.

      And the same thing goes for initializing data, null checks, math overflow, etc. Since I don't want to have to worry about all those potential problems (like taking control of my whole server), I choose to write my services in a language where I can never see uninitialized data, keep running after dereferencing a null pointer, or access outside the bounds of an array/file/buffer.

      Programming in C is like being a construction worker on the frame of a tall building without a safety harness. Sure, you can just be more careful, and you can usually prevent yourself from falling. However with that safety harness you never have to worry about falling so you can spend your time building your building instead of walking slowly or making sure you're not too close to the edge.

      dom

    63. Re: This seems to reinforce how clueless he is by Pseudonym · · Score: 1

      Only division (and plain right shift) actually works differently on signed vs unsigned types.

      Also comparisons and word extensions (zero extension vs signed extension). I've probably missed one or two more operations.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    64. Re: This seems to reinforce how clueless he is by loufoque · · Score: 1

      The changes made by C++11, 14 and 17 are all pretty minor.
      It always astounds me how those new revisions of the language got people to write better code, which would have worked fine with C++98 as well.

    65. Re: This seems to reinforce how clueless he is by F.Ultra · · Score: 1

      Of course but "to change the internal calling convention only" was not was what claimed if I want to be that pedantic semantics asshat :-)

    66. Re: This seems to reinforce how clueless he is by david_thornley · · Score: 3, Informative

      The changes made by C++11, 14 and 17 are all pretty minor.

      That is not the opinion of anybody I've seen who actually uses the language. The changes make C++ a much better language.

      It always astounds me how those new revisions of the language got people to write better code, which would have worked fine with C++98 as well.

      Some of the new library features were adapted from Boost, but you're welcome to try writing lambdas and using move semantics (and std::unique_ptr) in C++98. "auto" was completely repurposed, since as far as anyone could tell nobody actually used it, and you can use it to write templates you couldn't in C++98. Plenty of other changes.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    67. Re: This seems to reinforce how clueless he is by loufoque · · Score: 1

      I've been on the C++ standards committee since 2010.
      None of the changes are that fundamental.

    68. Re: This seems to reinforce how clueless he is by david_thornley · · Score: 1

      And yet the language is very much improved. It's much easier to write good programs in it.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    69. Re:This seems to reinforce how clueless he is by shutdown+-p+now · · Score: 1

      I would much prefer a language that allows me low level things (there is no reason you cannot implement a Pascal-style string in C, for instance) instead of forcing some restricted choice of operations decided by the language or library committees.

      Well, except for the part where you still have to use functions for concatenation, comparison etc. And if you want anything more than fixed-sized string (or just hope it fits into 255 bytes, as Pascal programmers did back in the day), then you also need to manage memory - which, of course, you'll still have to do manually in C, including for all the possible temporaries you might generate.

      C++, on the other hand, offers you exactly what you ask: namely, language facilities that are powerful enough to actually implement a string type of your own, complete with memory management and convenient operators, the way you want. You also get std::string, because it's a pretty basic type that should really be in the standard library - but you don't have to use it, and even the rest of the standard library doesn't require you to.

    70. Re:This seems to reinforce how clueless he is by Anonymous Coward · · Score: 0

      > C++, on the other hand, offers you exactly what you ask

      Exactly, you get those features AND the low-level things such as pointers and character arrays.

      Some people deride C++ because it "papers over" C with more advanced features instead of replacing them. I like the fact that I have a choice about how to implement things, old school or new school - and if you structure your code well, you'll never run into conflicts because you can isolate the different approaches in different modules. You can even write half your program in C, half in C++ and link it all together. I don't want to give up that kind of power.

  2. business code by afidel · · Score: 4, Insightful

    There's enough business logic programmed in C++ and Java to keep both languages around until my kids retire and they're not yet in the workforce. Rust and Go, yeah doubt there's a single company of any size running their business processes on either.

    --
    There are 4 boxes to use in the defense of liberty: soap, ballot, jury, ammo. Use in that order. Starting now.
    1. Re:business code by abies · · Score: 3, Informative

      Rust and Go, yeah doubt there's a single company of any size running their business processes on either.

      Regarding Go. Ever heard about Google? They are running a lot of it...

      Docker is written in Go. Docker is probably single biggest thing happening in devops area in few last years and many, many companies are deploying it in production. And docker is exactly the thing you are 'running you business process on' ;)

    2. Re:business code by friesofdoom · · Score: 4, Insightful

      Great, until google decide to axe go for whatever reason they come up with, pay a bunch of interns to port all the code to another language and leave you eating dust...

    3. Re:business code by Anonymous Coward · · Score: 0

      Docker is probably single biggest thing happening in devops area in few last years and many, many companies are deploying it in production.

      Didn't we already have the article on "why are there still so many security vulnerabilities?"

    4. Re:business code by friesofdoom · · Score: 4, Informative

      I dont think ac has a grasp on how many times google has pulled that trick before xD

    5. Re:business code by Anonymous Coward · · Score: 0

      Sure. That will happen. What a cogent scenario. /s

      It will happen because Google has done it again and again and again with all their software "beta" projects.
      Google will let down as fast as any other big corporation having its pet language. Apply this truism for Microsoft, Apple etc... You'd have to be a fucking idiot to base all your software on ONE company's software language.

    6. Re:business code by MrDozR · · Score: 1

      I think you missed the point. Companies might be running their business logic contained in Docker, but the underlying logic is not written in Go. Doesn't need to be. Ours is written in Java and some small bits in C# and CoffeeScript (I think). I'd bet the majority of companies are not going to replace their well-known, easy-to-resource, stable (as in, isn't easily deprecated) 'old' language with Go just because that's what the container runs.

    7. Re:business code by abies · · Score: 1, Insightful

      Great, until google decide to axe go for whatever reason they come up with, pay a bunch of interns to port all the code to another language and leave you eating dust...

      Statement was about ' doubt there's a single company of any size running their business processes', not about long-term stability of language. Please do not move goalposts.

    8. Re:business code by BESTouff · · Score: 3, Informative

      Rust and Go, yeah doubt there's a single company of any size running their business processes on either.

      You didn't even check before posting. Go is used at many companies, and even the younger Rust makes some money: https://www.rust-lang.org/en-U...

    9. Re: business code by Anonymous Coward · · Score: 0

      So 3 memory safe languages and 2 statically typed. That already removes most of the impetus to change any way.

      It's c(++) which needs to die.

    10. Re:business code by MartinG · · Score: 3, Informative

      I work for a FTSE250 UK company and we're running lots of Go in production and the company now depends upon it for important business processes. We continue to see an aggressive growth the use of Go in most areas of IT in our company.

      We also have one specific bit of code in Rust also running in production because Go is not appropriate for it, but we're unlikely to increase the use of rust much more.

      My previous company (a major UK based international publisher) is in a similar position since I introduced Go there a few years back.

      So, that's two companies of reasonable size running their business processes on Go.

      --
      -- MartinG To mail me: echo kewyjlcxyzvjfxbqwh | tr bcefhjklqvwxyz .@adgimnoprstu
    11. Re:business code by lucasnate1 · · Score: 1

      Docker is one program. If I remember correctly, the backend for Facebook chat was written in Erlang, yet no one claims that Facebook is based on Erlang.

    12. Re:business code by Anonymous Coward · · Score: 0

      Anyone endorsing Java as good is unfit for further rational discussion.

      Java hugely sucks and there is little good about it. Not to say it's entirely absent. But Java sucks. It's embarrassing ESR said such a thing.

    13. Re: business code by Anonymous Coward · · Score: 0

      Are you retarded?

      Google does that constantly. Over and over. There are tens of thousands of abandoned projects littering Google created whenever the "brilliant" children who inhabit it's halls find some new shiny metal object.

    14. Re:business code by abies · · Score: 1

      Can you please take this plush reproduction of a brain and show where java did hurt you?

      Were you force fed stateful entity beans every day?
      Have dependencies been injected into you with spring?
      Were you called cafe babe and forced to servlet people you didn't know?
      Was all your cache taken from you?
      Did they tell you to collect garbage without any pauses?
      Or was it loading of classes from unverified sources which really got you scared?

      Something has happened. Talking about it might help you.

    15. Re:business code by friesofdoom · · Score: 1

      My apologies. My brain automatically filtered out the parts of your comment that were less than worthless and what remained was just "xyz google service uses go"

    16. Re: business code by Anonymous Coward · · Score: 0

      Killing off failed or struggling products isn't a bad thing. It's a very good thing! It's stupid for an organization to waste resources on a product that isn't profitable, or otherwise isn't providing suitable value. It draws away resources that could be used to improve their successful products, or that could be used or initiate new projects that could be future successes. Something would be terribly wrong if Google wasn't discarding failed products.

      While you focus on the failures, you also ignore how Google's successful projects are successful for a long time. Look at Search, GMail, Maps, AdWords, AdSense, Analytics, Android, and so on. It turns out that Go has been a success and it too fits in among those other products that have been successful. So that greatly diminishes the risk of Go being discarded. Google has a track record of giving excellent support to successful projects.

    17. Re:business code by jeremyp · · Score: 1

      Wikipedia has 44 pages about discontinued Google services.

      --
      All I want is a secure system where it's easy to do anything I want. Is that too much to ask ~~ Randall Munroe
    18. Re:business code by Anonymous Coward · · Score: 0

      Boxing.

    19. Re:business code by fahrbot-bot · · Score: 1

      There's enough business logic programmed in C++ and Java to keep both languages around until my kids retire and they're not yet in the workforce. Rust and Go, yeah doubt there's a single company of any size running their business processes on either.

      Similarly: s/C++ and Java/COBOL/

      --
      It must have been something you assimilated. . . .
    20. Re:business code by fahrbot-bot · · Score: 1

      Rust and Go, yeah doubt there's a single company of any size running their business processes on either.

      Regarding Go. Ever heard about Google? They are running a lot of it...

      Ya, but it's all still in beta. :-)

      --
      It must have been something you assimilated. . . .
    21. Re:business code by Anonymous Coward · · Score: 0

      You parse and summarize incorrectly, then. Should be simply:

      "Docker uses Go."

      With the implication that Docker (which isn't owned by Google) is so ubiquitous and run in production on thousands of companies -- many of which are Fortune 500 companies, there's no need to even mention Google as an example of a company that uses it.

      You made the absurd claim that you (presumably being some sort of expert in this area) would be surprised if a single company of any size used Go. Docker has revenues of $800 Million/year and rising. Rather than being grateful with your fellow slashdotter for enlightening your ignorance, you berate their comments as being "less than worthless" and incorrectly summarize their post as merely "xyz google service uses go." You miss the larger implication that Docker develops in Go, and Fortune 500 companies are using Docker. Clearly this is relevant to your comment and certainly not "less than worthless."

      As for your moving the goal posts to Google supporting their pet language of nearly a decade, Go's compiler and other language tools are all open source, so if Google stops developing the language itself, it'll likely be forked if it's worthwhile to someone to maintain and update it.

      I'm not a Go fanboy, but I thought it's worth pointing out that you were clearly rude to someone who was trying to educate you... and rude again in your insincere apology to them about changing the argument.

      While their posts contributed to knowledge, yours contributed only ignorance, arrogance, and nastiness. Perhaps it's time to re-evaluate why you choose to post if your comments are coming off this way to others.

    22. Re:business code by Anonymous Coward · · Score: 0

      I think you completely missed his point. His example was docker (nothing to do with google's internal projects). If your concern is that google will stop funding go, that's a valid concern. But that does not often define the success/failure of a language. Helps a lot no doubt. Second concern would be an open standard and alternate compilers in case google does bail on golang. I suspect at that point, you'll have the dockers and dropboxes of the world taking over. While I get your concern about google languages tend to be different from say toolkits. I'd also be wary of google's toolkits given their wavering support. OTOH there are great examples of why this darwinian approach is good - see if you can get a better web framework than angularX. It is by far the best there is.

    23. Re:business code by Tough+Love · · Score: 1

      Rust and Go, yeah doubt there's a single company of any size running their business processes on either

      I don't know about Go's popularity for business processes, but I do know that there is a huge pile of middleware out there already, written in Go. I don't see any reason why it would be bad for business processes.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    24. Re:business code by Anonymous Coward · · Score: 0

      Possibly more of an expert than you.

      Even if docker is used at multiple F500 companies, it is a far cry from "running their business". We can find an example of pretty much every language ever in our companies, most of which are worthless and replaceable use cases. What Docker actually uses under the hood is of substantially less interest than the color of your underwear.

    25. Re: business code by Anonymous Coward · · Score: 0

      Java survived the death of SUN. Oracle can't manhandle it to death.

      Why should Go, rust, swift be different?

    26. Re:business code by Anonymous Coward · · Score: 0

      Boxing.

      "sandBOXING"

      TFTFY

    27. Re:business code by Anonymous Coward · · Score: 0

      What are the main attractions of the language what you have discovered from these specific cases, if you can talk about it? SCPs, packaging, compilation speed,..?

    28. Re:business code by Anonymous Coward · · Score: 0

      Examine that Rust list closely and you'll find it to be nonsense very quickly. Check the Baidu link, for example.

  3. hipster losers love their buzzwords by Anonymous Coward · · Score: 0

    rust and go will only be popular in the hipster circles

    1. Re:hipster losers love their buzzwords by footNipple · · Score: 1

      I work with a company that can be best described as "Anti-Hipster" and we've make a pretty big infrastructure investment with GO. I personally love working with it as there's not a lot of second guessing when making design decisions.

  4. you know you've arrived.. by Anonymous Coward · · Score: 1

    when people refer to you by your initials....

    MLK
    JFK
    FDR

    and now...

    ESR

    1. Re:you know you've arrived.. by Anonymous Coward · · Score: 1

      Are you new here? We've been calling him that since decades ago.

      He's ESR as opposed to RMS.

      Next you're going to ask me who is RMS...

    2. Re:you know you've arrived.. by Anonymous Coward · · Score: 0

      Don't forget JLO!

    3. Re:you know you've arrived.. by amalcolm · · Score: 2

      Equivalent series resistance and root mean square, obviously

      --
      Time for bed, said Zebedee - boing
  5. Why refer to him as ESR? by Roodvlees · · Score: 3, Insightful

    He's a person, not a technical description.
    We have enough abbreviations in tech.
    Hate it when people do that.

    --
    Thank you, Bradley Manning, Edward Snowden and so many others, for courageously defending humanity, my freedom and more!
    1. Re:Why refer to him as ESR? by jawtheshark · · Score: 3, Insightful

      Consider it a sign of respect in the open source community. You are someone if you get your own three letter acronym. At least it was, twenty years ago.

      --
      Ahhh...the great dumpster continuum. Many a free computer will be found there. -- sowth (748135)
    2. Re: Why refer to him as ESR? by Anonymous Coward · · Score: 1

      He's a person, not a technical description.
      We have enough abbreviations in tech.
      Hate it when people do that.

      He's a person? That's somewhat questionable.

      But that's how he refers to himself.

      And he talks in the third person. The autism is strong in that one.

    3. Re: Why refer to him as ESR? by Anonymous Coward · · Score: 0

      So many morons outing themselves by using "autist" as a derogatory term to describe people who are simply more sophisticated than themselves. SMH

    4. Re:Why refer to him as ESR? by Anonymous Coward · · Score: 3, Informative

      Computer usernames were the nicknames that geeks of yon' generations used for each other. Especially if you used early chat programs on the old timesharing systems:

      ken - Ken Thompson
      dmr- Dennis Ritchie
      bwk - Brian Kernighan
      esr - Eric Raymond

    5. Re:Why refer to him as ESR? by brunomagalhaeslopes · · Score: 3, Informative

      ESR is adopted by Eric himself, in his e-mail (esr@snark.thyrsus.com) and his personal home page (http://www.catb.org/~esr/).

    6. Re:Why refer to him as ESR? by Anonymous Coward · · Score: 0

      He's a person, not a technical description.

      I think in this specific case, he may be considered a technical description.

    7. Re:Why refer to him as ESR? by Anonymous Coward · · Score: 3, Funny

      Because if you say his name in full three times, he'll appear, rant about the second amendment for a while, and shoot your dog.

    8. Re: Why refer to him as ESR? by Anonymous Coward · · Score: 0

      So many morons outing themselves by using "autist" as a derogatory term to describe people who are simply more sophisticated than themselves. SMH

      These are textbook psychiatric indications of Autism. There is nothing 'wrong' with Autism, it is what it is. No idea why you jumped on that as 'derogatory'.

      The question was why does he refer to himself that way. That is the answer. 'Sophistication' is not.

    9. Re:Why refer to him as ESR? by Bing+Tsher+E · · Score: 3, Insightful

      ESR is a gadfly. He has produced almost no useful code himself. He is an extremely productive gadfly because he has nestled into the culture deep and knows how to stir up shit in ways that provokes actually productive into participating in discussions.

      But he's still just a gadfly.

    10. Re:Why refer to him as ESR? by Bing+Tsher+E · · Score: 1

      correction:

      That should have read 'actually productive people'

      ('people' was omitted)

    11. Re:Why refer to him as ESR? by Anonymous Coward · · Score: 0

      He has a rather high series resistance though...

    12. Re:Why refer to him as ESR? by kcelery · · Score: 2

      If you have to ask who ESR is in slashdot, you must be a stranger here.

    13. Re:Why refer to him as ESR? by Anonymous Coward · · Score: 0

      Welcome! You must be new here!

    14. Re:Why refer to him as ESR? by Anonymous Coward · · Score: 0

      ESR is an abstraction of Eric. It is an object oriented form of Eric with inheritance of all his Comp Sci qualities.

    15. Re:Why refer to him as ESR? by Anonymous Coward · · Score: 0

      Some guy with a two million something user id doesn't know who ESR is and it's our fault. Kill yaself my dude.

    16. Re: Why refer to him as ESR? by Wootery · · Score: 1

      There is nothing 'wrong' with Autism, it is what it is.

      Maybe I'm putting too much stock in Wikipedia, but here are the first five words from the article on autism: Autism is a neurodevelopmental disorder.

      It inhibits a person's ability to thrive in society. That's why it's called a disorder. It's not helping anyone to pretend otherwise.

    17. Re:Why refer to him as ESR? by Anonymous Coward · · Score: 0

      And yet, having been on /. for 2 decades... I do not know who ESR is.

      Disclaimer: I am not a programmer, so maybe, just maybe, those of you who are, which is likely a large reader base at /., would and do.

      Don't expect all readers here to be programmers, nor to know who the presumed 'coding architects' are, beyond maybe Stroustrup, and Torvalds...

      I appreciate the links, and will likely now know who ESR is moving forward, but I wouldn't expect others to necessarily retain that reference. Nor should you.

    18. Re:Why refer to him as ESR? by Anonymous Coward · · Score: 0

      Now we need RMS to post a retort with his thoughts.

    19. Re:Why refer to him as ESR? by Anonymous Coward · · Score: 0

      If you have to ask who ESR is in slashdot, you must be a stranger here.

      Ok, then let me ask why ESR is in Slashdot.

    20. Re:Why refer to him as ESR? by Anonymous Coward · · Score: 0

      Sorry bud.

      Been on /. 2 decades, when 'Taco' ran things..... and I'm sure it's possible I read one of the articles about him, but if you'd asked me yesterday what or who 'ESR' is, I couldn't tell ya.

      This is a tech site. More than just programming topics, discussion.
      And as I'm not a programmer, I usually skip the programming, or language specific stories.

      Familiar with yes, Torvalds, and Stroustrup, but ESR? Nope. Not going to lose sleep over it, and I'm sure another article about him will be posted in a year.

      Wash, rinse, repeat, and move on. I have bigger fish to fry than to remember who ESR is specifically. Or his opine on the downfall of C+.

    21. Re: Why refer to him as ESR? by imrahilj · · Score: 1

      There is pretty good reason to believe that being on the high functioning end of the autism spectrum may be good for going into a field like programming. Evolution doesn't care whether something is classified as a disorder or not, just whether it increases fitness.

    22. Re:Why refer to him as ESR? by Tough+Love · · Score: 1

      We have enough abbreviations in tech. Hate it when people do that.

      You are just going to have to slit your wrists then because in this industry, even TLR is a TLR.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    23. Re:Why refer to him as ESR? by LinuxIsGarbage · · Score: 1

      Linus Torvalds doesn't seem to go by "LBT", and he's definitely a somebody in the open source community, leading one of the most influential projects.

      I guess you have to be crazy and not shower, or wear shoes like RMS to get respect in the open source community. . .

    24. Re:Why refer to him as ESR? by Anonymous Coward · · Score: 0

      Wait, I thought that was the ATF...

    25. Re:Why refer to him as ESR? by Eunuchswear · · Score: 1

      One of these things is not like the others, or, from the sublime to the ridiculous.

      --
      Watch this Heartland Institute video
    26. Re:Why refer to him as ESR? by Eunuchswear · · Score: 1

      All his comp sci qualities? The empty set?

      --
      Watch this Heartland Institute video
    27. Re: Why refer to him as ESR? by Wootery · · Score: 1

      high functioning end

      Well there you have it. You just said it's not benign.

    28. Re:Why refer to him as ESR? by Aristos+Mazer · · Score: 1

      I wouldn't expect slashdot to explain "BitCoin" every time the term is used these days. I wouldn't expect a music magazine to explain Madonna as Madonna Louise Ciccone. And combining both of those examples together, I wouldn't expect slashdot to explain ESR. For any term or phrase, there has to be some threshold of commonality where you can assume your audience knows what it is otherwise you have to constantly explain every term. ESR is sufficiently famous that "Who is ESR?" on Google lists Raymond as the first hit. Likewise "ESR computer". I think there are enough posts, links, and regular news about ESR to justify using that as the man's name, and it is easy enough to find for anyone who doesn't know that I don't think it creates a significant barrier to entry.

      Having said that, everyone has a different standard... you mention "maybe Stroustrup, and Torvalds" -- I bet more people know ESR than Stroustrup. ESR makes it into the popular press from time to time. I've never seen Stroustrup pop up outside of tech literature. YMMV. (Acronym used without expansion on first reference for bonus irony points.)

  6. Provided you have infinite hardware resources... by Opportunist · · Score: 4, Insightful

    The higher the level of abstraction in your language, the higher the overhead it will create. Now, it needn't be so absolutely stupidly overengineered as .net is, but still the metric fits, the more safeguards and handrails your language comes with, the higher the overhead it incurs to have them. This is admittedly not really a huge problem in today's working environment because our computer speeds are far greater than our needs.

    Still, somehow it feels silly that I need increasingly more powerful computers just to run the same kind of program, only because programmers can't be assed to learn their trade and instead rely on ridiculously overblown frameworks that is the equivalent of delivering a pack of soda with a semi because you have to bring a soda factory along with the workforce since the framework doesn't know how to deliver a single soda.

    --
    We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
  7. java programmers, lol by friesofdoom · · Score: 0, Flamebait

    Breaking: java programmer has trouble understanding void* and memory allocation, thinks 100ms of garbage collection every now and then is fine. News at 11.

    Did this guy ever write anything that needed to be fast or realtime?

    1. Re:java programmers, lol by Anonymous Coward · · Score: 0

      Golang's concurrent GC is better and improving further:
      https://making.pusher.com/golangs-real-time-gc-in-theory-and-practice/

      (when searching use "golang", not "go")

    2. Re:java programmers, lol by alexgieg · · Score: 1

      Did this guy ever write anything that needed to be fast or realtime?

      How can you be here and not know who ESR is?

      --
      Conservatism: (n.) love of the existing evils. Liberalism: (n.) desire to substitute new evils for the existing ones.
    3. Re:java programmers, lol by Anonymous Coward · · Score: 0

      I'm pretty sure that ESR has written more mission-critical code in more programming languages than you will write in your lifetime.

    4. Re:java programmers, lol by friesofdoom · · Score: 1

      Bwahahahahahahahahahaha. I was gonna write an actual response but it would be a waste of my time. I do not suffer fools gladly.

    5. Re: java programmers, lol by Anonymous Coward · · Score: 0

      Fool.

    6. Re:java programmers, lol by nomadic · · Score: 1

      "I'm pretty sure that ESR has written more mission-critical code in more programming languages than you will write in your lifetime."

      He couldn't name those programs. Well, they're important but you wouldn't know them. They all live in Canada, that's why you never see them.

    7. Re:java programmers, lol by angel'o'sphere · · Score: 1

      He did not ask who he is, but what fast or realtime software he wrote ;D
      Just nitpicking, of course.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  8. In defense of C++ by Dutch+Gun · · Score: 5, Interesting

    The reason we have to say "don't do that" is because C++ remains compatible with C and older version of C++. There are literally billions of lines of existing C++ code out there, and the language committee realizes it can't just snap its finger and order everyone to rewrite all that old code (which is stable, functional, and debugged, btw) because we have something newer and better now.

    It's pretty straightforward to write safe, new C++ code if you understand how to use the new features and abstractions. I wrote an entire game / game engine recently using modern C++, and it's amazing how few bugs I've had thanks to recent language improvements and techniques.

    I'm not sure where this "large projects can't enforce code discipline" idea comes from. What does he think "coding standards" are, which nearly every major company, organization, or project has? And if someone doesn't understand how to use a smart pointer instead of a raw pointer or avoiding class inheritance hell at this point, then really, they shouldn't be contributing to your C++ projects.

    I get it that some people dislike or distrust C++. It's a complex language that's hard to master. They don't like that it makes a lot of compromises in the name of practicality, but that real-world practicality is why many of us use it for large, performance-critical real-world projects. I'd never argue that C++ is the right language for every project. In fact, it's a fairly specialized language at this point. But that level of hyperbole is a bit annoying.

    --
    Irony: Agile development has too much intertia to be abandoned now.
    1. Re:In defense of C++ by K.+S.+Kyosuke · · Score: 3, Insightful

      and debugged

      Amply demonstrated by the numerous memory exploits? ;)

      --
      Ezekiel 23:20
    2. Re:In defense of C++ by gnupun · · Score: 2

      I get it that some people dislike or distrust C++. It's a complex language that's hard to master.

      And once you master it, there's limited benefits. It's useful for large, complex programs where speed is important. Examples are games, browsers, large desktop apps etc. That's it -- it's useful in a very small amount of software. For any other type of software, you can use C, Java, Python, Rust, Nim etc.

      Languages like Rust (which is already used in browsers like Firefox) and Nim (which has a very efficient reference counting GC) are the future where performance is important. If you want high performance and an easy to use language, use Nim -- it's slower than C by about 20%, which is not bad. If your software cannot tolerate GC pauses, then use Rust although it's a lot harder to code than Nim.

      ESR statements about Go are bogus. Go is a gimped version of Java although it is less verbose. If speed is not important in your app, use Python. Java has better features than Go (like exception handling) and similar GC performance.

    3. Re:In defense of C++ by The+Cynical+Critic · · Score: 2, Insightful

      It's useful for large, complex programs where speed is important. That's it -- it's useful in a very small amount of software.

      Not sure what your frame of reference is, but that's a LOT of software. Hell, it's basically everything that isn't trivial or severely memory constrained. Had to switch form C++ to C once for a pretty heavily memory constrained embedded application, but otherwise I've been able to get away with using C++ practically everywhere.

      --
      "Why should I want to make anything up? Life's bad enough as it is without wanting to invent any more of it."
    4. Re:In defense of C++ by MichaelSmith · · Score: 2

      I'm not sure where this "large projects can't enforce code discipline" idea comes from. What does he think "coding standards" are

      Won't help you when your code is 30 years old and has been hacked around by slave labour in the form of military conscripts and customer provided "consultants".

    5. Re:In defense of C++ by Tranzistors · · Score: 1

      C compatibility gives C++ and advantage to become C replacement, since it provides a clear migration path:
      0) write unit / integration tests and retest after each step,
      1) compile project with c++ compiler, fix compiler errors and warnings,
      2) find all mallocs / frees and replace with smart pointers,
      3) [doing whole bunch of other modernizing stuff]

      Even only doing steps up to (2) opens possibilities to write new code in a safer manner. Of course, if the existing code base is horrible mess and rewrite from scratch is a better option, then cool new languages are just as good, but lack of manpower is a persistent problem in open source world anyway.

      Any rational arguments aside, if people just don't like C++, they won't write software in C++.

      Disclaimer: I work with software that is written in C/C++ and I would rather see it all moved to modern C++.

    6. Re:In defense of C++ by religionofpeas · · Score: 2

      And if someone doesn't understand how to use a smart pointer instead of a raw pointer or avoiding class inheritance hell at this point, then really, they shouldn't be contributing to your C++ projects.

      Maybe the projects aren't mine. Maybe the project is run by a business, and I'm just one of the people in the team, and the boss has hired a few idiots as well.

    7. Re:In defense of C++ by Anonymous Coward · · Score: 0

      > What does he think "coding standards" are, which nearly every major company, organization, or project has?

      And just how do you enforce them? Don't come with code reviews. You're lucky if you can get even 1 in 4 of your developers to do a good job in them.
      Bonus points if you can do this enforcement without pissing your best people off so much that the leave you, because that's worse than ignoring coding standards.
      Also, in any really big project you'll eventually have a team/group of people contributing that don't follow coding standards. Not to mention that most of them are so much crap that it's questionable if they even should be followed.

    8. Re:In defense of C++ by gnupun · · Score: 3, Insightful

      Not sure what your frame of reference is, but that's a LOT of software.

      No, it's not. Few programmers work on projects that are millions of lines of code and it has to be as fast as possible (real-time).

      For servers, memory is cheap ($200 extra) so you can just use Java for that 2 million LOC project.

      That leaves C++ only for AI, professional games and large desktop apps (Photoshop, browsers, office etc.). While these types of software are used a lot, no more than 100,000 programmers are working on this, at any given time.

      For in-house desktop apps of medium complexity (upto say 500k LOC), you can use C# or VB.net.

      Even for games, where low time for development is paramount, the engine is written by one company in C++. Then dozens of other companies use that engine and Lua or some other scripting language to actually write the game quickly.

      The remaining 95% programmers can use a sane programming language like C, Python, Swift, Java, Rust, Nim or even Go.

      Bottom line: programmer time is money for the company and C++ probably has the 2nd highest cost per line of code compared to other languages (assembly language is 1st in cost/LOC).

    9. Re:In defense of C++ by TheRaven64 · · Score: 4, Interesting
      I've recently started using C++ for a bunch of things where I would previously have used a scripting language. It has basically everything I want from such a language:
      • Closures (including compile-time specialisation with C++14 auto parameter lambdas).
      • A rich set of collection classes (written by people who actually care about performance).
      • Regular expressions.
      • Smart pointers (so I don't need to think about memory management)
      • Futures / promises and threads.
      • A tiny dependency footprint (so my code will run on pretty much any *NIX system)

      Most of the time, I can compile at -O0 and run in less time than it takes the Python interpreter to start and if I find that performance actually does matter then I can quickly profile it, find the bottleneck, and replace it with something a lot more efficient.

      --
      I am TheRaven on Soylent News
    10. Re:In defense of C++ by CustomSolvers2 · · Score: 1

      find all mallocs / frees and replace with smart pointers

      Firstly, I want to highlight my limited experience with C (tons of experience in modern C-based languages though) and this comment being a honest concern. After that short introduction, here I go: I am currently developing a plain-C application and, as a way to adapt my modern-language expertise to the C peculiarities, I have come up with a set of methods simplifying things like memory management and array instantiation. That application is meant to systematically deal with strings of virtually any size what, together with the aforementioned methods expected to define a consistent overall structure, explains why that code mostly rely on malloc (+ free). Consider the following code snippet:

      stringVariable = StringAction_m(stringVariable, "literal to do whatever");
      //do all what is required with StringVariable
      free(stringVariable);

      The basic structure depicted by the aforementioned sample is applied everywhere in the referred code (string/array instantiation, string/array copy, etc.). All the methods including an ending "_m" return a variable which has been malloced and not freed. The first argument of all these methods (stringVariable in the sample) is the output variable. If that variable is different than NULL, the given method would free it before performing the corresponding allocation; what means that these methods might be called to instantiate a variable for the first time or to further modify a previous malloc-instantiated variable.

      I am quite comfortable with that approach, even despite my limited C experience. This seems a quite problem-free structure and, in the worst scenario, easy to be debugged; for example, I can immediately know whether a free statement is wrong by looking at the (ending "_m" in the name of the) function where the given variable was instantiated; note that there isn't a single malloc outside these functions. I am not planning to move to C++ or even to appreciably change that approach, but I do recognise my limited expertise in all this and would like to know whether I am missing something, perhaps not even for that specific development but for the future. You seem to not like malloc/free at all, so I guess that you are in an excellent position to tell me what might be wrong with that approach. What do you think?

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    11. Re:In defense of C++ by The+Cynical+Critic · · Score: 2

      For servers, memory is cheap ($200 extra) so you can just use Java for that 2 million LOC project.

      You may have been right a few years ago, but for the last couple of years memory, specially server memory, has become way more expensive due to supply simply not being apple to keep up with supply after much of the manufacturing capacity was shifted to making memory for mobile devices like smartphones and tablets. We're talking about a situation where's it's been badly eating into server vendor profit margins and sales due to increased cost. Thus memory use is important and so is performance when companies are more and more trying to get as much out of the hardware they buy.

      In my experience the whole "C++ is really expensive" meme is just a bunch of FUD spread by people trying to push other languages and is mostly based on an assumption of very low code quality, which would cause similar problems any other language. On a cost-per-line basis C++ really isn't any more expensive than C or Java and the other ones come with their own downsides and much lower availability of skilled developers (so you need to pay more devs or put up with devs making more mistakes in a language they're not very familiar with).

      The bottom line here is that C++ does 95% of jobs just as well or better than any other language with an availability of skilled developers no other language can really match.

      --
      "Why should I want to make anything up? Life's bad enough as it is without wanting to invent any more of it."
    12. Re:In defense of C++ by Dutch+Gun · · Score: 5, Insightful

      No computer language is going to help a project programmed by idiots.

      --
      Irony: Agile development has too much intertia to be abandoned now.
    13. Re:In defense of C++ by TheRaven64 · · Score: 2
      Your approach seems fine at first glance, but it looks like it would struggle when you get more complex data flow. Even in your three-line example, I have a few questions:

      What is the type of stringVariable? If it's char*, then how do I know when it's been stored on the heap and read back that it's dynamically allocated on the heap and so needs freeing?

      What are the ownership semantics of the first argument to StringAction_m? Since you're assigning the result to the input variable, I presume that it's taking an owning reference and explicitly destroying it?

      What happens when you have types that have more complex destruction than a simple free? For example, if you're doing a lot of string processing you probably want some kind of twine abstraction so that you don't end up doing a lot of temporary copies, but now your string data type is a linked list internally and just calling free on the first element will give you a memory leak.

      With a C++ equivalent, none of these problems arise. Your string type would be a wrapper that would know if it owned the memory. On-heap character arrays would probably be represented with std::shared_ptr, so that you could store them in multiple twines before writing them to flat containers. Your different string representations would expose a common iterator type and allow you to query the strings without having to always store them in sequential memory.

      TL;DR: It's not a question of what you can do in a language, it's a question of what you can do without thinking. I'd much rather have a language where the compiler deals with these issues and raises an error if I write something invalid than one where I have to be very careful to get things right that are going to be security issues if I get them wrong.

      --
      I am TheRaven on Soylent News
    14. Re:In defense of C++ by loonycyborg · · Score: 3, Insightful

      C++ still reigns supreme due to its flexibility. While in some less pragmatic language you are very likely to hit some roadblock because language designers wanted to enforce some principle which ended up counter productive in your particular case, it won't be so with C++. This language has no other principle than practicality, and it will never block you from getting the job done. Even it being superset of C ends up being another aspect of practicality. Because C ABI still is de facto standard for language interop and system APIs and is implementation language for astronomic number of important libs.

    15. Re:In defense of C++ by Jay+Maynard · · Score: 2

      Amen to that. I'm a developer on a 1.2MLOC project written almost entirely in C++. It's 15 years old by now, and has has literally a thousand pairs of hands in it. It's open source, and so the quality of code has varied mightily over those 15 years. It's a big, bloated, barely maintainable mess, and leaks memory like a sieve that's been blasted with a shotgun.

      I learned C++ hacking on that code. I also learned to hate it.

      This large project, at least, can't enforce code discipline, nor would it do any good if it could. It would take a total rewrite.

      --
      Disinfect the GNU General Public Virus!
    16. Re:In defense of C++ by religionofpeas · · Score: 4, Insightful

      No language can compensate for having idiots in your team, but some languages, like C++, make it worse.

      And remember: if you see no idiots on your team, you are the idiot.

    17. Re:In defense of C++ by volodymyrbiryuk · · Score: 2, Insightful

      For in-house desktop apps of medium complexity (upto say 500k LOC), you can use C# or VB.net.

      Ok stop right there. No one should use any of the .net crap except if you are forced to due to some Microsoft constraints.

      --
      sudo rm -r -f --no-preserve-root /
    18. Re:In defense of C++ by CustomSolvers2 · · Score: 1

      What is the type of stringVariable? If it's char*, then how do I know when it's been stored on the heap and read back that it's dynamically allocated on the heap and so needs freeing?

      It is char* and has certainly been stored on the heap because everything is instantiated via malloc. As said, one of my intentions was too create an overall consistent approach usable in any situation. I don't need to worry about different types of strings or any other thing: everything is compatible with everything else and has the same requirements like calling free afterwards.

      What are the ownership semantics of the first argument to StringAction_m? Since you're assigning the result to the input variable, I presume that it's taking an owning reference and explicitly destroying it?

      When you call StringAction_m, you can choose to instantiate a variable from scratch and not care about anything else by passing the first argument as NULL or else. A descriptive example to understand that second scenario is concatenation (this is precisely where I firstly though about that approach); if you want to concatenate stringVariable2 to stringVariable1, the call stringVariable1 = Concatenate_m(stringVariable1, stringVariable1, stringVariable2); performs the concatenation in a temporary variable, frees stringVar1 and copies that temporary variable to stringVar1 which is then returned.

      What happens when you have types that have more complex destruction than a simple free? For example, if you're doing a lot of string processing you probably want some kind of twine abstraction so that you don't end up doing a lot of temporary copies, but now your string data type is a linked list internally and just calling free on the first element will give you a memory leak.

      In one of the first versions of that approach, I accounted for more complex scenarios but everything became too buggy and problematic. So, finally I decided to rely on the shown simple structure and, for complex situations, I simply rely on (+ free) temporary variables by calling these methods as many times as required. Once you get used to the format, it is quite intuitive.

      TL;DR: It's not a question of what you can do in a language, it's a question of what you can do without thinking.

      I am not absolutely defending one language over other one, not here and not anywhere else. Under my specific conditions where performance is a very important aspect, C seems a better option. Again for that specific scenario (quite low-level-ish, where I am mostly relying on quite simple programming structures), the proposed approach seems quite friendly: I have came up with/got used to it relatively quickly.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    19. Re:In defense of C++ by Tranzistors · · Score: 1

      [..] what might be wrong with that approach [...]

      Since I write C++, I'm not sure I can comment if this approach is wrong in the context of C language. From C++ perspective I see some risks:

      • Since object ownership is managed by convention (function call with "_m" suffix), it is up to the programmer to remember to clean up. With C++ unique_ptr the clean-up would happen when the pointer is nulled or goes out of scope.
      • If the //do all what is required with StringVariable block contains return statements, free() must be called before that. If there are several such allocated strings, programmer must pay close attention to which such strings must be freed. In more complex code I have seen functions ending with clean-up blocks, which is a neat idiom, but still is error prone. C++ smart pointers do that automatically.
      • That code does essentially the same thing that std::string does. The C++ string implementation has been tested to death and probably has fewer bugs.
    20. Re:In defense of C++ by Anonymous Coward · · Score: 0

      As opposed to XSS and remote code execution flaws in modern and "safe" languages? God bless electron for showing how brainlessly layering abstractions only moves the target. No need to abuse buffer overflows to get to aslr^1 protected code when your high level framework evals data from untrusted sources with full permissions.

      ^1 Address space layout randomisation stores functions at random addresses, making it hard for an attacker to find and use them. An attacker can no longer just insert the address of a known function to execute it since that varies with each execution.

    21. Re:In defense of C++ by CustomSolvers2 · · Score: 1

      What you are saying is also true for any managed-memory language. C++ smart pointers might be an intermediate step between pure C and a language automatically managing all the memory related aspects, but they still represent a (performance) cost. Logically, I would prefer to not worry about memory (de)allocation at all, although I am using C for this development for good reasons: I want that program to be as quick as possible and all the required code is quite simple in the sense of not really needing complex programming resources.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    22. Re: In defense of C++ by Zero__Kelvin · · Score: 1

      You can use C++ STL strings which do everything you want and much more. By simply writing your C like code in C++ and doing this your code will be raised to write, easier to read, safer, and perform as well or better. You don't HAVE to use classes. In fact the only difference between a struct and a class in C++ is that members of a class default to private access while in a struct they default to public.

      --
      Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
    23. Re:In defense of C++ by TheRaven64 · · Score: 1

      It is char* and has certainly been stored on the heap because everything is instantiated via malloc

      Except in your example, where one of them was a string literal (so const char * and definitely not safe to free) and the other was a heap-allocated char*. This means that you're either having separate functions for string literals vs malloc'd strings, or you're always responsible for manually freeing the second one. In contrast, if you did this in C++, then your string class would have a constructor that took a const char * and set the don't free flag by default, and you'd get implicit conversion automatically.

      In one of the first versions of that approach, I accounted for more complex scenarios but everything became too buggy and problematic. So, finally I decided to rely on the shown simple structure and, for complex situations, I simply rely on (+ free) temporary variables by calling these methods as many times as required. Once you get used to the format, it is quite intuitive.

      It may be simpler, but now you're doing a lot of redundant memory allocation, a lot of redundant copying, and tying all consumers of your code to the implementation of your data structure. I doubt that the performance will be better than doing the same thing in a scripting language (probably worse, because most scripting languages have fairly well optimised string implementations), so you're doing manual memory management to get worse performance.

      Under my specific conditions where performance is a very important aspect, C seems a better option

      Performance is a very important aspect... and yet you're willing to use O(n) algorithms and lots of malloc / free calls in places where constant-time algorithms would work with far fewer malloc / free calls and with much better cache usage?

      This is the real problem with the 'C is fast' mentality: a good algorithm almost always beats a bad algorithm by a far larger margin than a fast language implementation beats a slow language implementation, and C is forcing you to use a worse data structure and algorithm than C++. No matter how much you tune your C code, it's going to be slower than if you'd used a better algorithm.

      You don't, by any chance, work on Enlightenment do you?

      --
      I am TheRaven on Soylent News
    24. Re:In defense of C++ by lordlod · · Score: 1

      I am a C coder and love it.

      I have come up with a set of methods simplifying things like memory management and array instantiation.

      Your method seems sane and will help you significantly, it will however cause issues as your code base grows. As an example non-linear code like callbacks may trip you up. Having multiple copies of your string pointer, possibly storing one or more of them in a struct and knowing when the free should be called. There are numerous issues that will crop up from time to time, all can be solved with care and the addition of extra layers such as reference counting.

      The biggest issue with your approach is that it assumes that you personally are infallible. You might be good, but you aren't that good. And the impact of screwing it up is high.

      I strongly suggest looking at the talloc library. It is an alternative memory pool with reference counting. It greatly simplifies your code, removes the need for conventions and significantly reduces the risk and impact of a mistake.

    25. Re:In defense of C++ by Tranzistors · · Score: 1

      What you are saying is also true for any managed-memory language

      C++ memory management has an added benefit that it frees memory deterministically (that is, as soon as leaving scope or reference cont reaching 0 in case of shared_ptr), not when runtime feels like it.

      C++ smart pointers [...] still represent a (performance) cost.

      Not necessarily. unique_ptr should be about as fast as properly managed raw pointers.

      I want that program to be as quick as possible

      Fair enough. C++ is built with speed in mind. Given that compilers can do some crazy optimizations and even assembly code is gets interpreted by the CPU, it's nigh impossible to judge performance just by reading code. Perhaps your memory management code has is better that that of std::string since you have intimate knowledge of the input data, but maybe std::string authors thought of neat performance trick you didn't know. Try some benchmarking with various optimization flags (people usually settle on -02 as default optimization level) and see which is better for your needs.

    26. Re:In defense of C++ by CustomSolvers2 · · Score: 1

      Except in your example, where one of them was a string literal (so const char * and definitely not safe to free) and the other was a heap-allocated char*.

      That scenario isn't possible, as far as there is no string literal assignation. Rather than doing stringVar = "string literal", I always do stringVar = AssignStringLiteral_m(NULL, "string literal");. As said, all my code is extremely consistent and inter-compatible.

      It may be simpler, but now you're doing a lot of redundant memory allocation, a lot of redundant copying, and tying all consumers of your code to the implementation of your data structure.

      I am not sure if you got the idea. Rather than reusing the same variable in various calls; I rely on a temporary variables. The proposed format works fine upto 1 variable reuse. Allocation/deallocating small amounts of memory (= dealing with local variables in any language automatically dealing with memory allocation) doesn't seem an issue.

      I doubt that the performance will be better than doing the same thing in a scripting language (probably worse, because most scripting languages have fairly well optimised string implementations), so you're doing manual memory management to get worse performance.

      Why? All what I am doing is avoiding writing malloc, string copy, etc. every time and call methods performing those actions. Are you saying that string operations in C are slower than in a scripting language? I don't think that this is even close to being true. Just for your information, I am comparing the preliminary versions of the resulting piece of software against well-established programs (i.e., database management tools like MySQL or PostgreSQL) and it performs notably better in quite a few scenarios; although it is quite difficult to tell for sure what is the most influential aspect (algorithms/data structures or optimised usage of C), a bad language usage wouldn't allow such a situation to happen.

      and yet you're willing to use O(n) algorithms and lots of malloc / free calls in places where constant-time algorithms would work with far fewer malloc / free calls and with much better cache usage?

      No idea where you are getting all that from what I have written so far. The only weak point of the described approach might be relying on malloc rather than on a quicker string definition, which is also associated with a much lower available space what isn't precisely ideal under my specific conditions (should be able to deal with strings of any size). I might take a further look at all this at a later stage to further optimise its performance; for the time being, my only concern was coming up with an approach allowing me to intuitively maximise the C performance and that seemed a quite acceptable trade-off.

      You don't, by any chance, work on Enlightenment do you?

      I don't get that reference. If you are really asking me whether I work for a company called Enlightenment, I am not. I am a self-employed and this has been an R&D+practicing-a-bit-C project which is part of my self-promotion. I am always trying to learn/improve, help potential clients to know more about my skills, etc.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    27. Re:In defense of C++ by Anonymous Coward · · Score: 1

      If it's leaking memory like a sieve that's been blasted with a shotgun, then fix it. It's called valgrind. Learn it. Use it. You'll love it almost immediately.

    28. Re: In defense of C++ by CustomSolvers2 · · Score: 1

      Getting the best performance possible was one of my main concerns since the very beginning of this project, that's why I chose C (additionally, I wanted to work on this language which I haven't used much since quite long time ago). As commented to others, relying on C++ under these conditions as a way to slightly minimise the C unfriendliness doesn't make too much sense: firstly, because it will always come at a (performance) cost; and secondly because the way to get comfortable with a language isn't precisely avoiding it. I personally have no problems with the described approach and, as per all the comments so far, I don't see any compelling reason to stop using it/rely on C++

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    29. Re: In defense of C++ by Anonymous Coward · · Score: 0

      Are there language features in c (++) which would avoid those classes of bugs? No.

      Are there language features in memory safe languages which prevent buffer overflows and use after free? Yes.

      False equivalence ... what else could you expect from c coders?

    30. Re: In defense of C++ by Anonymous Coward · · Score: 0

      Only because society pays for the cost of your bugs ...

    31. Re:In defense of C++ by gnupun · · Score: 1, Insightful

      How is this insightful? Desktop apps require GUI design and .net GUI design tools are excellent. Even the macos Xcode GUI design tools are far behind. With performance in par with Java, C# is a good choice for in-house apps with a good blend of development speed and app performance. /. mods are very biased.

    32. Re:In defense of C++ by CustomSolvers2 · · Score: 1

      Having multiple copies of your string pointer, possibly storing one or more of them in a struct and knowing when the free should be called.

      I rely every time on the same proceeding: new malloc (indirectly via call to any of those methods). Most of my code is based on local variables and, for global ones, I had created specific populate/free methods (BTW, there are also methods to properly free arrays). As commented to others, I perfectly understand the limitations of C, even my approach; trying to do something similar just for some other developments in which I am working would be a true nightmare. But this specific implementation is quite C-peculiarities-compatible and I have kept the code as plain and simple as possible. Main main concerns are: as fast as possible (+ as less external resources usage as possible), as intuitive/me-friendly as possible and as problem-free as possible (= regularly repeating equivalent patterns, relying on local variables, etc.).

      The biggest issue with your approach is that it assumes that you personally are infallible. You might be good, but you aren't that good. And the impact of screwing it up is high.

      I am certainly not (just look at the numerous errors in a big proportion of my posts here. LOL) and I can make mistakes by using C or any other language. In the specific case of C and, at least for someone with my modern-language background, the main problem is memory (de)allocation and that's why I came up with this friendly-to-me methodology. I can make many errors in this code, but will certainly minimise and quickly locate/fix all the memory-related ones.

      I strongly suggest looking at the talloc library

      Thanks for the suggestion. I will look at it at some point. In any case, I am almost certain that will not use it in the current implementation as far as it would go against my two main concerns: minimising reliance on external resources and getting properly used to work with C.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    33. Re:In defense of C++ by TheRaven64 · · Score: 1

      That scenario isn't possible, as far as there is no string literal assignation. Rather than doing stringVar = "string literal", I always do stringVar = AssignStringLiteral_m(NULL, "string literal");. As said, all my code is extremely consistent and inter-compatible.

      Okay, so the ownership semantics for the second argument (and later ones?) is always that of a non-owning pointer, so you must explicitly free it. Now you have a model where some things take an owning pointer and some take a non-owning pointer and you're relying on convention to make sure that you don't mix these up. I really hope that you've written a static checker to enforce this.

      Why? All what I am doing is avoiding writing malloc, string copy, etc. every time and call methods performing those actions

      You're still doing the malloc / copy, you're just doing it inside the function.

      Are you saying that string operations in C are slower than in a scripting language?

      No, a well-optimised string library in C (such as glib strings) will be faster than wrapping a well-optimised string library in a scripting language. In contrast, you're using a set of API design choices that preclude most of the common string processing optimisations. If you instead use a scripting language then you'll have some overhead from the interpreter, but your underlying implementation of the string (which is probably written in C or C++) will be a lot faster.

      No idea where you are getting all that from what I have written so far. The only weak point of the described approach might be relying on malloc rather than on a quicker string definition, which is also associated with a much lower available space what isn't precisely ideal under my specific conditions (should be able to deal with strings of any size). I might take a further look at all this at a later stage to further optimise its performance; for the time being, my only concern was coming up with an approach allowing me to intuitively maximise the C performance and that seemed a quite acceptable trade-off.

      Your design, using raw C strings, prevents you from storing a length separately (so you keep needing O(n) strlen calls), prevents you from implicitly sharing large strings (so you need O(n) copies) and prevents you from deferring copying using the twine optimisation (so you need more O(n) copies). It's such a case study in bad design that Raymond Chen wrote a blog about how not to do string processing 20 years ago describing it.

      I don't get that reference. If you are really asking me whether I work for a company called Enlightenment, I am not.

      Enlightenment is a window manager that has spawned the Enlightenment Foundation Libraries, a framework that is infamous for making design decisions like this that give them all of the performance of an interpreted scripting language combined with all of the type and memory safety of C.

      --
      I am TheRaven on Soylent News
    34. Re:In defense of C++ by CustomSolvers2 · · Score: 1

      Try some benchmarking with various optimization flags (people usually settle on -02 as default optimization level) and see which is better for your needs.

      I am a bit saturated with work and that specific development is already way behind schedule, but your suggestion is quite reasonable. I will do a proper benchmarking at some point to confirm my preliminary assumptions.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    35. Re:In defense of C++ by Anonymous Coward · · Score: 0

      Indeed. Write the GUI front-end in .NET and pair it with a back-end that fits your needs.

    36. Re:In defense of C++ by Anonymous Coward · · Score: 0

      Java has better features than Go (like exception handling)

      That may be true but exceptions and exception handling are abominations. Option, Either, and Validation types are better ways of typing results of partial functions.

    37. Re:In defense of C++ by CustomSolvers2 · · Score: 1

      Okay, so the ownership semantics for the second argument (and later ones?) is always that of a non-owning pointer, so you must explicitly free it.

      It it seriously not that difficult. You seem to be more interested in looking for problems than in properly understanding what I am explaining! Let me try it again: all the string variables in this code have been instantiated in the same way (i.e., via calling one of the multiple methods, all of them relying on the same basic malloc/free rules) and all of them are expected to be freed right after being used. You can call one of these methods with 10 arguments and it would only care about freeing/not the first one; all the remaining ones are mostly used as constants and, in any case, they will never be freed/allocated/ inside those methods. So, if you do var1 = whateverFunction_m(var1, var2, var3, var4), you would get a properly malloced var1 which has to be freed and other three variables, whose allocation happened at previous points, which will be freed after their last usage, whateverFunction_m doesn't care about any of them. In fact and as far as I am mostly relying on local variables, the "_m" flag is almost irrelevant because all the string (or array) variables declared in a given method have certainly be instantiated via malloc and certainly need to be released before existing the given method. Do I need to make the small effort to write free/call the array freeing method for each allocated variable? Yes. Would I prefer to not worry about anything of this? Yes. Is that a tremendous problem for me? No, at least not after having got used to this methodology. In case of making a mistake, it would be extremely difficult for me to locate a wrong (de)allocation bit? No, I have done it already quite a few times; every time very quickly. Do I expect everyone to like, use and enjoy that approach? No! Does it work for me? Yes. Is everything clear now?

      You're still doing the malloc / copy, you're just doing it inside the function.

      This is precisely what I meant, sorry for not having phrased it properly.

      No, a well-optimised string library in C (such as glib strings) will be faster than wrapping a well-optimised string library in a scripting language. In contrast, you're using a set of API design choices that preclude most of the common string processing optimisations.

      Not so sure about that, but as said in a previous comment I wouldn't mind to do some proper tests to confirm these issues. In any case, this development is going quite well for me so far + have lots of over-work and will look into all this at other point.

      Your design, using raw C strings, prevents you from storing a length separately (so you keep needing O(n) strlen calls), prevents you from implicitly sharing large strings (so you need O(n) copies) and prevents you from deferring copying using the twine optimisation (so you need more O(n) copies). It's such a case study in bad design that Raymond Chen wrote a blog about how not to do string processing 20 years ago describing it.

      Well, perhaps I should also take a look at this part too. Two comments though: I am getting the length at allocation and almost never call strlen at a later point; I prefer to sacrifice a bit on exchange of overall consistency/ease of use (a bit which might remove at a later point via over-optimisation of a properly working code).

      the performance of an interpreted scripting language

      As far as you keep making that pointless comparison, I will also highlight that some of the referred methods perform (logically, slightly different versions of) actions delivered by in-built C methods and that I did some preliminary comparisons where both these versions were proven to have a similar performance. I have also to do much more testing on this front, again at a later point. If that future tests prove that my versions are appreciably slower, I certainly will consider to somehow modify my approach.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    38. Re:In defense of C++ by Anonymous Coward · · Score: 0

      If speed is not important in your app, use Python

      Also use python if you don't mind not being able to terminate a loop / function / if statement block without ending the file.

      And once you master it, there's limited benefits. It's useful for large, complex programs where speed is important. Examples are games, browsers, large desktop apps etc. That's it -- it's useful in a very small amount of software.

      Emphisis mine.

      So, it's only useful in the most commonly used software products to date, that in some cases is responsible for running all of those fancy "webapps" that everyone likes so much, and is used practically everywhere regardless as to the purpose of the program / user actually using it / proficiency required, and it's some how a niche area that's irrelevant?!?!? What a response, I have no words....

      If your software cannot tolerate GC pauses

      If your software needs to rely on GC, then you're doing it wrong, or the language prohibits you from managing memory to any reliable degree. (Something that a finite state machine kinda has a max limit of, and that a program needs to be aware of if it wants to be able to preserve it's data, or preferably keep on running if possible, if the system runs out of it.)

      This is the issue I have with these languages. They assume the developer is an idiot, and hand hold them to the point that they forget the limits and boundaries of the machine that they are programming. Then they want to know why their code keeps crashing when they get a NULL pointer in a for loop, and demand that the compiler fix it for them. I'd argue that we need to get rid of these languages. Yes, allowing people to code without being able to recite ASM verbatim from memory is a good thing, but you need to have a basic understanding of the underlying concepts before you try to mess with anything while expecting it to keep working, and most of the current crop of new "programmers" do not have that understanding. This is negatively impacting far too many people as a result, and should be curtailed in someway. I'm not saying out right forbid programming to unproven individuals, nor am I suggesting a licensing requirement, but I am suggesting that the bar be raised back up, at least to the point that the word "programmer" is not synonymous with the description "cut and paste code monkey".

    39. Re: In defense of C++ by PoopJuggler · · Score: 1

      Are there language features in c (++) which would avoid those classes of bugs? No.

      Well sure, if by "no" you mean "yes".

    40. Re: In defense of C++ by The+Cynical+Critic · · Score: 1

      So how is that any different than with any other language? If you hire incompetent devs you're going to be getting bugs regardless of what language you're using and with C++ you've got one of the biggest talent pools around, meaning that with C++ the availability of competent developers is better than just about every language out there.

      --
      "Why should I want to make anything up? Life's bad enough as it is without wanting to invent any more of it."
    41. Re:In defense of C++ by PmanAce · · Score: 1

      How so? .Net core is arguably faster than nodejs, it's open source and cross platform.

      --
      Tired of my customary (Score:1)
    42. Re:In defense of C++ by mark-t · · Score: 1

      Every game company for which I've worked has had their own game engine behind several of their projects. They'll use a standard one for a project if circumstances warrant it, but just as often as not, they would use their own.

    43. Re:In defense of C++ by K.+S.+Kyosuke · · Score: 1

      As opposed to XSS and remote code execution flaws in modern and "safe" languages?

      What languages are you referring to?

      God bless electron for showing how brainlessly layering abstractions only moves the target.

      Electron is written in C++, isn't it?

      No need to abuse buffer overflows

      ...which is a C++ feature.

      when your high level framework evals data from untrusted sources with full permissions.

      I never said you can't make design mistakes in other languages than C++. :)

      --
      Ezekiel 23:20
    44. Re:In defense of C++ by squiggleslash · · Score: 3, Insightful

      No computer language is going to help a project programmed by idiots.

      That's just not true. Programming languages can enforce constraints that make common errors either difficult or impossible.

      I have to admit a disenchantment with software development in general these days, largely because the consensus within the community is that fast and cheap is better than reliable and secure. We pick programming languages like PHP and C++ where we know we're going to make errors we're never going to be able to debug, and often will be completely unaware of until they strike, because meh who cares I can write in {insecure language} and I like it so sucks to be users right? Besides I'm a genius and would never make those mistakes (yes you will, asshole.)

      I refuse to read another ESR article on principle, he's a jack-ass, and I seriously doubt Go is going to be taking over from C any time soon, but I generally agree with the sentiment that we made a mistake going away from Java, back to languages that are optimized towards making errors. Java is too bureaucratic, and C# is nearly as bad, and while it's overstated I do generally agree that there needs to be more control over GC for the average programmer, but there has to be a happy medium here - better than Java doesn't have to mean insane type checkers and/or going back to directly manipulating pointers.

      And yeah, I know C++ has smartpointers. But it also has regular old shit pointers. And sure, you would only use the latter in the right circumstances, but, let's be honest, all those other programmers you work with, who you are soooooo much smarter than, wouldn't...

      --
      You are not alone. This is not normal. None of this is normal.
    45. Re:In defense of C++ by Anonymous Coward · · Score: 0

      Electron is written in C++, isn't it?

      Electron based apps are written in JavaScript, HTML and CSS. Electron itself is just the underlying web stack. Since it is a fully functional web stack you get all the exploits of running untrusted JavaScript in eval with full access to the local file system and other functionality that normal desktop apps enjoy. Simply opening a malicious project description with it would be enough for an attacker to take over the application and anything it has access to. I think they "fixed" that by removing some example files used when the exploit was reported.

      ...which is a C++ feature.

      And somewhat mitigated by address space layout randomisation. Not perfect but a lot harder to exploit when Microsoft doesn't "accidentally" disable it.

    46. Re:In defense of C++ by Anonymous Coward · · Score: 0

      Doesn't that just mean whoever was in charge of managing the code base did a poor job? How do you let memory leaks into production code? Seems like little to no testing, no code reviews...I think what you are trying to say is that your project has a general lack of experience all around.

      You have simply re-enforced "A fool with a tool is still a fool."

    47. Re:In defense of C++ by david_thornley · · Score: 1

      What I'm getting out of that is that you carefully constructed a string library that needs some conventions to be safe, and doesn't do complicated things because that gets buggy.

      I'm not knocking your achievement, but you get most or all of that in C++ for free with simpler syntax. With C++, you get a lot of it in template format, not function-calling, and that might run faster. You don't need to use more C++ than that to get a significant benefit.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    48. Re:In defense of C++ by TheRaven64 · · Score: 1
      I don't think I'm misunderstanding what you're doing - I've seen a lot of novice C programmers try exactly the same approach and you're making a bunch of rookie errors:

      You are writing an API that deals with C strings explicitly. This means that you're tying all consumers of your API into a single data representation at the API level, you can't even change the representation by recompiling, so you have tight coupling of API and data representation. This is bad software engineering.

      You are losing one of the benefits of C/C++ by forcing all objects to be allocated on the heap. If your strings are mutable (which it looks as if they are, from your API description), you can't put them in globals, even when you have some that are probably never going to be modified, because that would break your API contract. C++ strings in a modern implementation gain a lot from being able to be allocated on the stack and modified without any heap allocations.

      In the specific case of strings, the length of a string is always known at creation time. C didn't store the length of strings inline because storing a size_t in every string would have been too much overhead on machines where RAM was a lot more scarce than even most embedded systems today. This means that raw C string manipulation needs to recompute the length every time. Pretty much all other string libraries where anyone has cared about performance written in the last 30 years store the size in the string object. With your model, you say that you are getting the length at allocation time, but then you're not returning it and so the next function that uses it as an argument needs to recompute it.

      For mutable strings, it is common to differentiate between the amount of allocated space and the amount of space in the string. This makes appending cheaper, because appending a few characters individually can be done without needing to reallocate each time, at the potential cost of some RAM.

      String libraries that are intended to do a lot of concatenation use the twine model. The simplest form of twine is simply a linked list of strings. You can append strings in constant time and then do a single copy lazily to flatten later (if required). More complex versions use skip lists or similar for searching, but that's only needed if you want to support amortised constant time random access. Again, this is impossible to do if your exported data type is a C string. For comparison, look at LLVM's Twine family of classes, which implements the twine model and can use C or C++ strings as nodes, and will perform a single copy for the result of an arbitrary number of concatenate operations.

      You are tying your memory management policy tightly to your API in such a way that effectively precludes data sharing. There is no way to add reference counted strings in your model, for example. If you implemented twines and kept appending the same string to a load of others, then the best way of doing that would be to have multiple references to a single string that's shared between all of them and then copy it when you flatten. It's also not possible to, for example, provide a zero-copy substring function.

      --
      I am TheRaven on Soylent News
    49. Re:In defense of C++ by angel'o'sphere · · Score: 1

      You are strongly advised to get a teacher, the stuff you do is just nonsense.
      Why the heck would your example function Concatenate_m call "free" on any of its arguments?

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    50. Re:In defense of C++ by angel'o'sphere · · Score: 1

      And remember: if you see no idiots on your team, you are the idiot.
      It is the opposite around. Idiots always believe all the others are idiots.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    51. Re:In defense of C++ by CustomSolvers2 · · Score: 1

      What I'm getting out of that is that you carefully constructed a string library that needs some conventions to be safe, and doesn't do complicated things because that gets buggy.

      Not exactly. I started a quite demanding development by relying on a language in which I have not too much experience (even though I have lots of experience in many C-based languages). As far as I am not used to the C peculiarities, I spent a relevant amount of time at the start in coming up with a friendly framework allowing me to write code more or less as usual; so, I created quite a few string-modifying methods (because this aspect is very important in that development) similar to the ones you can find in many modern languages. Gradually, I realised about the importance of having an easy-to-use methodology to deal with C memory peculiarities, came up with a methodology and adapted those first methods to it. Despite understanding the importance of that initial part, this was logically quite secondary and that's why I didn't want to spend too much time on it (+ needed to actually test the approach to confirm/dismiss it was really allowing me to comfortably write code). In a first moment, I accounted for multiple-time-used variables, but that approach wasn't too friendly (at least, not for me); that's why I finally decided to let it as explained here: just 1-reuse per variable (anything beyond that requires a temporary variable). I have been using this methodology during the last months for that development and I am quite happy with the results. There is a public repository if you want to get a better picture about all this. In fact, I did include a link to it in one of past conversations, not sure if you visited it.

      I'm not knocking your achievement

      The referred methodology isn't exactly an achievement, but a side-effect of me wanting to work comfortably. My only relevant achievement here is the resulting application (because I am keeping its main code private for the time being) which is still in a very preliminary/beta stage. On the other hand, I am reading lots of people having problems with C and I am so comfortable with that methodology that I have even thought about creating an independent library to be used by anyone interested. I even asked here in a previous thread, but nobody showed any interest.

      but you get most or all of that in C++ for free with simpler syntax. With C++, you get a lot of it in template format

      As commented to others here and to you in the past, I am very happy with this approach and will continue doing that development in C. Out of curiousity and to confirm/dismiss what honestly aren't more than reasonable assumptions, I might do some serious benchmarking C/C++ to get better insights into their performance differences. I might also test/further optimise my approach to see whether it might be even faster. But all those are now secondary concerns for me as far as the performance so far is excellent and I am very comfortable by doing that development in plain C.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    52. Re:In defense of C++ by Anonymous Coward · · Score: 0

      No computer language is going to help a project programmed by idiots.

      But C++ helps them to hide in plain sight.

    53. Re:In defense of C++ by Anonymous Coward · · Score: 0

      Learning C++ by looking at legacy C++ code is the worst possible way to learn C++.

    54. Re:In defense of C++ by Anonymous Coward · · Score: 0

      The company I work for explicitly tests for C++ knowledge regarding pointers. We don't hire idiots. We HAVE hired C programmers who understood pointers, but not C++, though. I think we altered our interview process after that.

      Even if someone has snuck through, we have a comprehensive code review process on every checkin.

    55. Re:In defense of C++ by CustomSolvers2 · · Score: 1

      You are strongly advised to get a teacher, the stuff you do is just nonsense. Why the heck would your example function Concatenate_m call "free" on any of its arguments?

      ??!! You can answer posts without caring about the signature all you want (-> this is what you said me the last time we talked), but I cannot refrain myself from remembering you. Out of all the conversations we have had (not sure, but I think that you might have written me over 20 posts), I have only read one sensible enough comment (the previous to the last one). The rest of them are so ridiculous (+ aggressive?!) that I don't even know how to answer them! Make yourself a favour and read what all the other people in this thread have written and compare them with your nonsense!! Seriously, what is wrong with you? Please, learn to behave or ignore me. I will be extremely non-patient with you and, in case of doubt, I will simply not reply you. This is the last time I clarify you nothing.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    56. Re:In defense of C++ by phantomfive · · Score: 1

      Wow, that's the best commendation of modern C++ I've read so far, nice.

      --
      "First they came for the slanderers and i said nothing."
    57. Re:In defense of C++ by gnupun · · Score: 2

      So, it's only useful in the most commonly used software products to date, that in some cases is responsible for running all of those fancy "webapps" that everyone likes so much, and is used practically everywhere regardless as to the purpose of the program / user actually using it / proficiency required, and it's some how a niche area that's irrelevant?!?!? What a response, I have no words....

      It's like an OS, something that is very important. Yet how many developers code OSes for a living or as a hobby? Extremely few. Let's see if Rust can unseat C++ from its throne since it is as fast as C++ with a lot of safety features. As efficient C++ is at runtime, it's badly designed for the programmer at development time.

      If your software needs to rely on GC, then you're doing it wrong

      Trying to figure out where any of the hundreds of dynamically allocated objects should be freed is something that should be automated, otherwise you end up with something like Firefox (a C++ app) -- a huge memory leaker that uses up GBs of RAM even if you have closed all the tabs.

      This is the issue I have with these languages. They assume the developer is an idiot, and hand hold them to the point that they forget the limits and boundaries of the machine that they are programming. Then they want to know why their code keeps crashing when they get a NULL pointer in a for loop, and demand that the compiler fix it for them. I'd argue that we need to get rid of these languages.

      Why use software programmers at all? Just do all your tasks in Verilog/VHDL hardware languages and manufacture ASIC chips using that code. Except nobody will do that, because it's expensive as hell (10000x or more costly). People are definitely going to use Python if it's 10x faster than C++ in development time for some simple task. C++ is now in a position that assembly used be many decades ago -- use it only if there is no other option. But unlike assembly, it's really badly designed.

    58. Re:In defense of C++ by CustomSolvers2 · · Score: 1

      Although you seem a quite knowledgeable and sensible person, you are mostly making generic and kind-of-out-of-context references. For example, you are relying on too many generic descriptions (= out-of-context definitions) whose real value is close to zero; you call O(n) something as simple and quick as calling strlen (-> looping through the characters of a single string! One of the fastest things ever) and compare that situation with any other one which you consider that deserves the O(n) label. This is a tremendously inaccurate analysis. Just for your information and out of all the critics you have made to my heap reliance, the only relevant issue is (slight) performance differences which, as said, are partially compensated by my intention of making the whole approach consistent (+ eventually, further optimisable in the future) and string-size-/memory-availability-independent enough. On exchange of that, I get the lightest programming resources (= just pure C), a friendly(-at-least-for-me) environment and the most adaptable/improvable/extensible code which I might further improve/modify in the future, even though it is currently outperforming big names in their field (developed mostly in C++, I think).

      I am afraid that this conversation has moved from actually-trying-to-understand/help to the fanatic-like (no offense intended) world, more focused on generic certainties whose reliability in general or under the given conditions is usually none. I am particularly intolerant to said behaviours because I think that they represent pretty much all what is wrong with the software development world: ideally, an objective-correctness/technical field where everything can be easily confirmed/dismissed; practically an extremely faulty sub-world where many people with limited knowledge and not precisely honesty/objectivity in their minds think that can impose whatever egoist interest via group-pressure/repetition. Again, I think that you are a quite knowledgeable person and I am not even completely dismissing some of your points (and will certainly do some tests); but unfortunately you seemed to have misinterpreted my interest about knowing more and going further with me lacking/expecting a canned-knowledge dose. I am grateful for your insights, will certainly welcome any tangible proof of any of your abstract points (I can link a public repository including a descriptive sample of the code I have been commenting if you want) and don't want to offend you, but this has been more than enough abstract talking for me.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    59. Re:In defense of C++ by angel'o'sphere · · Score: 1

      What is wrong with you?

      I gave you a honest tip, as you ignored all the other posts/answers and answer to them the same nonsense over and over again.

      Why the funk is your example function freeing its first argument? And how can you come to the idea that this makes any sense?

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    60. Re: In defense of C++ by networkBoy · · Score: 1

      he's just using the 0==success enum, but his function is positive boolean logic. It'll all shake out in QA.

      --
      whois gawk date unzip strip find touch finger mount join nice man top fsck grep eject more yes exit umount sleep dump
    61. Re:In defense of C++ by networkBoy · · Score: 1

      indeed in the last 6 months the cheap DDR4 8GB ECC dimms have gone up from $85 to $110 each.

      --
      whois gawk date unzip strip find touch finger mount join nice man top fsck grep eject more yes exit umount sleep dump
    62. Re:In defense of C++ by CustomSolvers2 · · Score: 1

      Why the funk is your example function freeing its first argument? And how can you come to the idea that this makes any sense?

      OK. I will explain what I see wrong with your behaviour (which curiously haven't happen to any other commentator, but well...). Firstly, the answer to your question is implicit in my first post: the variable which is the first argument has the same name than the one taking the returned value which isn't declared there (= was declared before and perhaps something like a malloc happened). So, just by looking at the code, some people might know the answer, but additionally I expressly said "The first argument of all these methods (stringVariable in the sample) is the output variable" (output variable in that context seems quite evident that refers to the one being returned by the method). So, that first argument isn't exactly an argument in the conventional sense of the world, but the variable to be returned. Even despite all that, you might still have some doubts about that variable having to be freed. How to know that it was malloced before? Because I guess that you know that you have to free all the malloced variables before mallocing them again (this is precisely the reason for that first argument: reusing a variable which was malloced before). A sensible person being in that situation would ask me about that scenario and I would have answered "because all the string variables in that code are always instantiated via malloc". Even though none of the other commentators (all of them with apparently good knowledge about C/C++) had any doubt on this front, you might have missed that issue and asked me. But you didn't ask, you said "the stuff you do is just nonsense. Why the heck would your example function Concatenate_m call "free" on any of its arguments", so you aren't understanding what anyone else does and, on top of that, you don't ask, but attack?! Do you get it already? I don't think so. Do you know why? Because most of our previous 20 something iterations have been exactly like this one. I honestly don't know what is your problem (with me) and I don't care. This will be my last explanation: learn to behave (+ talk only if you know) or be ignored.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    63. Re:In defense of C++ by Anonymous Coward · · Score: 0

      Also, if you see no assholes on your team, you are the asshole.

    64. Re:In defense of C++ by angel'o'sphere · · Score: 1

      I have no problem with you.
      However your explanation (again) makes no sense at all.
      I might have a problem with your way of coding ... or explaining ... or justifying your code.

      But then again, you are not in my team, or I would ban you to cook coffee and do errands ...

      From your explanaitions it is clear to me you are beyond teaching how to program.

      You seriously should switch to languages like Python where topics like this don't raise up.

      Good luck.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    65. Re:In defense of C++ by serviscope_minor · · Score: 2

      I'm not sure where this "large projects can't enforce code discipline" idea comes from. What does he think "coding standards" are, which nearly every major company, organization, or project has? And if someone doesn't understand how to use a smart pointer instead of a raw pointer or avoiding class inheritance hell at this point, then really, they shouldn't be contributing to your C++ projects.

      I think basically he doesn't really like C++ a priori and is finding excuses.

      Plus he says this:

      . C is flawed, but it does have one immensely valuable property that C++ didn't keep -- if you can mentally model the hardware it's running on, you can easily see all the way down.

      to me that means he doesn't understand C++ even slightly and regards it as "C + weird magic". Whereas actually it's C + a bunch of automation. Excluding exceptions, you can translate any C++ program straightforwardly into C.

      Exceptions aren't complicated, but translating them into C is a bit more work, and it can't be done as efficiently as C++ exceptions. Going to asm is fine though.

      --
      SJW n. One who posts facts.
    66. Re:In defense of C++ by Anonymous Coward · · Score: 0

      Trying to figure out where any of the hundreds of dynamically allocated objects should be freed is something that should be automated, otherwise you end up with .....

      That's what } is for. When it goes out of scope, it's gone. Welcome to Modern C++.

    67. Re: In defense of C++ by serviscope_minor · · Score: 1

      . As commented to others, relying on C++ under these conditions as a way to slightly minimise the C unfriendliness doesn't make too much sense: firstly, because it will always come at a (performance) cost;

      That's false, though.

      --
      SJW n. One who posts facts.
    68. Re:In defense of C++ by squiggleslash · · Score: 1

      Good luck with that.

      --
      You are not alone. This is not normal. None of this is normal.
    69. Re: In defense of C++ by CustomSolvers2 · · Score: 1

      That's false, though.

      Although it seems quite safe assuming that the reality language1 vs. language1+more-things-on-top is associated with the first language being quicker, I cannot tell it for sure because I have never done a proper benchmark. So, it is extremely likely (according to basic objective common sense) that C is faster than C++ in these scenarios, but I cannot tell it for sure: I am honest person with a bit self-respect and professionalism who will never say that something is in some way for sure without having actually confirmed it. As said in other comments, I will do some serious benchmarking when possible; meanwhile, I will be happy with an application notably faster than other existing approaches. Also, feel free to back your absolute statement with something tangible.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    70. Re:In defense of C++ by Anonymous Coward · · Score: 0

      I just pass any issue back to the idiot in question with line number and reason. Gotta love valgrind and version control.

      The only time I have to spend arguing is when we have a logic error that most other languages wouldn't protect against either. By now I spend at least an hour trying to impress upon them the novelety of actually using the update function we have instead of directly manipulating (expected to be non-mutable) state in a multithreaded program. Adding that one line of code for the update call has to be somehow near impossible, despite it being used just three lines above for similar code. I am almost motivated to fix the issue myself, that is if there wasn't the attempt to blame it on me.

    71. Re:In defense of C++ by CustomSolvers2 · · Score: 1

      I see. I will try a version more adapted to your "peculiarities". Just follow the instructions below as well as you can, if you don't know how to do one of the steps, don't worry, because you tried and this is all what matters: someone, somewhere might eventually (and probably undeservedly) love you (I guess).

      1. Open your C compiler/IDE (if you need help on this, go to Youtube, type C compilation and watch the first video with puppets which you can find).
      2. Paste this code into the main file.
      3. Call LoopNoFunction() from the start up method, compile/execute and confirm that runs without any issue.
      4. Open your system memory log (CTRL+ALT+DEL on Windows or console+a program like htop on Linux), remove the first free(var0); in LoopNoFunction(), compile/run and be ready to terminate the execution as soon as possible (the memory usage will go up quite quickly!). This is why you have to release an allocated variable before reallocating it again!
      5. Now test LoopFunction() and confirm that it works fine like in step 3. Why? Because that function frees the variable every time. How can it do such a thing? Because it takes as a first argument the variable to be freed/returned! Magical, don't you think!

      LOOOOOOOOOOOOOOOOOOOOOOOOL.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    72. Re:In defense of C++ by sjames · · Score: 1

      Even for games, where low time for development is paramount, the engine is written by one company in C++. Then dozens of other companies use that engine and Lua or some other scripting language to actually write the game quickly.

      That's a good model for most software that needs high performance. Even batch style high performance software generally has critical and non-critical code. If the critical parts are bound together through a higher level language it's often easier to test and debug and when necessary, modify.

    73. Re:In defense of C++ by Anonymous Coward · · Score: 1

      If you can compile a C++ program in less time than it takes to start Python, you either have a really slow Python interpreter or a really tiny C++ program! C++ is legendary for being slow to compile, and now that they have link-time code generation, even linking is slow!

      Part of the problem with C++ is that you have to compile a whole program. You can't compile libraries separately because even changing compiler options can make a lib no longer binary compatible. Is there any other language where you have to ship precompiled binaries but can't ship precompiled libraries?

      dom

    74. Re:In defense of C++ by sjames · · Score: 1

      How well do those tools design GUIs running on X? Or native Mac apps?

      It's one thing to code to a portable framework, quite another to use a framework that nails you to a particular platform so hard that only a total re-write can set you free.

    75. Re: In defense of C++ by Anonymous Coward · · Score: 0

      Your intuition fails you here; C++ is based on the zero cost abstraction principle.

    76. Re:In defense of C++ by angel'o'sphere · · Score: 1

      As I said before: designing a system where every function frees the first argument, instead of freeing it yourself, is WRONG.

      But I wish you good luck with your programming career.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    77. Re:In defense of C++ by CustomSolvers2 · · Score: 1

      As I said before: designing a system where every function frees the first argument, instead of freeing it yourself, is WRONG.

      Are you seriously so stupid? Because it is quite clear to me that you are a quite dishonest person whose motivations aren't properly/adequately learning/understanding; no idea about why you do what you do and honestly don't care. But, on top of that and your evident lack of knowledge, you seem particularly stupid! Apparently, my previous comment was still too complicated for you. Unfortunately, I don't have any puppets with me at the moment, but I will try a still clearer version:

      1. Go back to the sample code which I wrote yesterday to try to address your "internal world".
      2. In LoopNoFunction, copy the var1 set (up to the first free(var0)) 10 times. Change all the variable names such that they remain unique; you can try with var3, var4, var5, etc. Do the same with LoopFunction.
      3. Now, you can redo the "experiment" in my post above and confirm that everything continues working/not if you remove/not any intermediate free.
      4. What have you learned now? That you can call that function as many times as you wish without caring about freeing the variable you are using (BTW, if it was an array, the freeing process would have been more complex than just calling free). Without the function, you would have to write as many free as times you re-malloc the variable. Additionally, if you miss any of them you might provoke a serious problem. So, rather than always calling free (or a method to perform the more complex freeing actions on an array) before calling that function, you can include that free inside the function itself! What implies both a lower number of irrelevant writing and a safer approach (= you will never forget about that free).

      You should bear in mind that this is just a very simple example helping you to understand what others understood immediately and without any additional help. The final goal is to always call whatever method without caring about malloc/pre-freeing malloced variables. A more descriptive example I wrote in a previous post: var1 = concatenate(var1, var1, var2); which performs the concatenation in a local variable, frees var1 (if required), mallocs it and copy that temporary variable to var1 which is returned; everything in 1 line what cannot be accomplished right away in any other way (you would have to rely on a temporary variable). What this approach does is accepting the underlying C/mallocing-freeing reality and simplifying its usage. I have been using this methodology for a while with a big number of different methods and it is extremely intuitive and error-free. Modesty apart, I came up with this approach (as more comprehensively described in other comments) within the first month of using C (for the first time in the last quite a few years; never for an important development) for a quite demanding implementation, got used to it and now (a few months later), I feel almost as comfortable with that format as with the more modern programming languages on which I usually rely: I almost make no mistakes and immediately debug the few I do. I will certainly keep further evolving/optimising it, but it already represents a quite good first version of what I intended to do: an intuitive way to easily deal with C for someone whose experience is mainly focused on managed-memory/modern programming languages. Anyway, sorry again for the lack of puppets and for having used so many words; and hopefully I will not talk to you ever again, at least, not before you evolve into a person (if you get there at all).

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    78. Re:In defense of C++ by Anonymous Coward · · Score: 0

      That's what } is for. When it goes out of scope, it's gone.

      That's called reference counting. Welcome to the world of GC, the thing you C++ers hate so much.

    79. Re: In defense of C++ by bingoUV · · Score: 1

      Although it seems quite safe assuming that the reality language1 vs. language1+more-things-on-top is associated with the first language being quicker, I cannot tell it for sure because I have never done a proper benchmark. So, it is extremely likely (according to basic objective common sense) that C is faster than C++ in these scenarios, but I cannot tell it for sure

      This basic objective common sense works when you consider both compile time and run time. C++ compilation might take longer, but it is no where close to necessary that the executable is less quicker than that of C.

      Of course, reasonable coding in both C and C++ is assumed.

      --
      Bingo Dictionary - Pragmatist, n. A myopic idealist.
    80. Re: In defense of C++ by CustomSolvers2 · · Score: 1

      C++ compilation might take longer, but it is no where close to necessary that the executable is less quicker than that of C

      This statement is as abstract as all the other ones written in previous comments here and even my preliminary assumption of expecting C to be quicker. As said to many other people before: I haven't done any proper benchmarking and, consequently, I am not in a position to absolutely confirm my looking-pretty-evident-to-me assumption. You or anyone else is welcome to do/refer a proper benchmark; otherwise, you can wait for me to do it myself what isn't precisely in my urgent-to-do list. You can also continue talking generically and without providing any kind of tangible support to your words by absolutely confirming/denying whatever concepts you think that make more/less sense, but please don't count me in.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    81. Re:In defense of C++ by TheRaven64 · · Score: 2

      If you can compile a C++ program in less time than it takes to start Python, you either have a really slow Python interpreter or a really tiny C++ program! C++ is legendary for being slow to compile, and now that they have link-time code generation, even linking is slow!

      I'm talking about really tiny C++ programs: A few dozen to a couple of hundred lines of code.

      Part of the problem with C++ is that you have to compile a whole program. You can't compile libraries separately because even changing compiler options can make a lib no longer binary compatible. Is there any other language where you have to ship precompiled binaries but can't ship precompiled libraries?

      That's only true on Windows. Every other OS has a standard C++ ABI and C++ libraries interoperate happily between compilers. Windows defines COM and C as the standard ABIs for libraries, but doesn't define a standard C++ ABI.

      --
      I am TheRaven on Soylent News
    82. Re: In defense of C++ by Zero__Kelvin · · Score: 1

      You are basing your judgement on what you think is true about C++ and I'm sure you have gained too much of you "understanding" of it reading comments here. Your assumption of extra cost is incorrect, and if you do as I recommend you are far more likely to end up with more efficient and safer code. You should consider going to YouTube and investing a few hours watching Bjarne Stroustrop's excellent presentations. I assure you that 90% of the criticism of C++ Here is bogus, and written by clueless people who don't like C++ because they don't know what they are talking about, and aren't going to educate themselves about C++ because they don't like it.

      --
      Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
    83. Re: In defense of C++ by CustomSolvers2 · · Score: 1

      watching Bjarne Stroustrop's excellent presentations

      So, you are suggesting me to get a proper/objective idea about something by watching what the author of one of the alternatives says about his baby? It doesn't sound like a too reliable source. LOL.

      I assure you that 90% of the criticism of C++ Here is bogus,

      I care pretty much the same about baseless criticism than promotion. I haven't read/cared/made any decision based on what a random person might write here or anywhere else about C++ or any other target of (honestly, no idea why this is the case at all) unreasonable hate/love. I mostly trust myself and my actual experience in whatever, what I might eventually complement with reasonable, empirically-proven ideas, sensible opinions of people who have shown a proper understanding/knowledge in the past and, in general, any further input, but mostly validated via personally confirming whatever statements are true/applicable to my situation.

      As explained since the first moment, moving the referred development to C++ is completely out of picture because of not making any sense under my specific conditions; namely: the code being already quite big and performing perfectly and me feeling quite comfortable with C (+ the dealing-with-C peculiarities approach I came up with). Additionally, one of the main reasons why I firstly thought about C despite my limited experience with it (I am a senior programmer with tons of experience in many other languages) was taking this development as an excuse to properly practice my skills on a so peculiar format. Since my first comment in this thread, I let my position completely clear and also what I was exclusively interested in: C programmers sharing their impressions about the approach I came up with, not because of having any problem about it or doubts or wanting to change anything, just out of pure knowledge extension: I am always looking for knowing more, improving further, etc. what has nothing to do with the behaviour which quite a few of you have been showing here (= almost fanatic adhesion to your approach and systematically trying to convince anyone else to do the same than your do mostly via systematic repetitions?! Why? For what? I will never understand these behaviours!). In fact, the main reason why I firstly posted here was to somehow share my quite positive experience and my non-existent problems when dealing with the C peculiarities about which so many people are systematically complaining.

      It seems that whatever I ask here (or in similar places) is automatically misinterpreted as a cry for help rather than as part of what any truly knowledgeable person should systematically be doing (are you seriously so blind that think that asking/wondering/always learning more isn't part of what having actual knowledge implies?). Some of you seem quite knowledgeable and some others extremely ignorant, but all of you share the same "I will teach you whatever canned bit" underlying nonsense! Teach me what? I am feeling so confident about my programming background that I have started a really tough development in a language like C, in which I haven't ever done any relevant work! I made that decision on the spot! I didn't do even a slight research about how should I proceed or what was the most recommendable proceeding! I plainly made many mistakes, learned from them and built an extremely-friendly-for-me approach pretty much on the go! Now, I am coding in C almost as intuitively and carelessly as I do in a modern programming language! I know that I can locate/debug those memory problems you are so scare about almost immediately! The piece of software I am developing is quite complex and is expected to have a good performance under very demanding conditions! And I have reached that stage in a few months, by bearing in mind that this is a quite secondary, R&D, in-my-free-time development! Most of you don't seem to be able to properly understand what I am describing and to properly assess its int

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    84. Re:In defense of C++ by david_thornley · · Score: 1

      I appreciate your process and comfort, but another C++ advantage is that lots of people know C++, whereas it appears that only a very few people (perhaps just you) understand your framework and how to use it. For a one-person project that doesn't need to outlive its maintainer, that's not a problem.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    85. Re: In defense of C++ by Pinky's+Brain · · Score: 1

      Other languages are less costly to society.

      Buffer overflow and use after free are some of the most costly bugs around, right after SQL injection and cross site scripting.

    86. Re:In defense of C++ by CustomSolvers2 · · Score: 1

      I appreciate your process and comfort, but another C++ advantage is that lots of people know C++, whereas it appears that only a very few people (perhaps just you) understand your framework and how to use it. For a one-person project that doesn't need to outlive its maintainer, that's not a problem.

      If I am out, all my code comes with me? I like that. LOL. Seriously though, this is really "a one-person project that doesn't need to outlive its maintainer" because its maintainer is the same person than its owner, promoter, developer, etc. = myself. I am using it just as a self-promotion of my real income source (being hired to work on whatever development) and only as a final executable because I will keeping it as private source for the time being. Honestly, I don't think that my methodology is so difficult to understand when its point is precisely to be user friendly for a person with limited C expertise, but I am fine with this not being the case too. As said, I only started this mini-thread and considered the eventuality of releasing an independent library because of thinking that other people might find it helpful. Nobody interested? OK, less publicly-releasing work for me :)

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    87. Re:In defense of C++ by slack_justyb · · Score: 1

      It's not a question of what you can do in a language, it's a question of what you can do without thinking.

      I have no idea why you aren't scored higher.

  9. Well, don't do that! by TheRaven64 · · Score: 4, Interesting

    Arguing that it's harder for large-scale projects to manage a 'well, don't do that' approach implies that he's completely missed the last 40 years of tool development. This is much more of a problem for small C++ projects than large ones. Large ones have pre-push hooks that run static checkers that enforce rules like no bare pointer and no operator new / delete. It's the smaller ones that rely on programmer discipline to do this that are more likely to have problems.

    Go is a horrible language. It has multithreading as a core part of the language, but no memory model and no type system that can express notions of sharing or immutability. The designers clearly realised that generic types are important, and so added precisely one to the language (the map type, which is parameterised on the key/value types). It has a map type that maps from one object type to another, but no way for users to define what equality (or ordered comparison or hash) means on objects.

    --
    I am TheRaven on Soylent News
    1. Re:Well, don't do that! by K.+S.+Kyosuke · · Score: 1

      but no memory model

      I thought the memory model was that a channel receive happens-after the corresponding channel send?

      --
      Ezekiel 23:20
    2. Re:Well, don't do that! by TheRaven64 · · Score: 5, Informative

      Sorry, I should have been more explicit. Messages sent over channels establish a happens-before relationship, but not with respect to any other memory operations. Everything else is non-atomic. That's fine in a language like Erlang, which doesn't allow mutable shared state (in Erlang, the only mutable object is the process dictionary, which cannot be shared), or Pony (and, I think, Rust) where the type system guarantees that no object is both shared between threads and mutable at the same time. In Go, the language makes it easy to share pointers to mutable objects, but then doesn't provide any guarantees about ordering or synchronisation for accesses to them.

      Go tells people to 'share data by communicating', which basically means that you shouldn't share mutable data you should share channels that are used to serialise operations on mutable data. That's fine as a programming model, but the language provides absolutely no help (either in the type system or the tooling) to ensure that code actually follows this model. If ESR's complaint about C++ is that it requires programmers to follow 'well, don't do that' rules, then he should hate Go, because the only way of using it to write correct programs is to carefully avoid doing something that the language makes easy to do accidentally. At least with C++, it's relatively easy to audit code for violations of the C++ Core Guidelines. It's practically impossible to audit Go code for sharing of pointers to mutable state (in the general case, Go's subtyping model means that it reduces to the halting problem, in the common case it's just really, really hard).

      --
      I am TheRaven on Soylent News
    3. Re:Well, don't do that! by K.+S.+Kyosuke · · Score: 3, Interesting

      I thought the idea was that sharing a reference to mutable data over a channel guarantees that all writes to the shared data by one goroutine are safely in memory before the recipient starts working with said data. There seem to be some extra operations for locked or atomic operations with shared values but the language seems to be pushing people into operating on shared data using workers that use channels to hand off ownership. There may be limitations to that approach, and nobody is checking automatically that you don't do something that you shouldn't be doing, but at least the space of good and bad things to do seems vastly simpler than in case of C++. Certainly it seems that working properly with ownership hand-offs in Go in most situations is easier than, say, working with dynamic memory management in C in most situations, even if it still depends on people not doing something stupid intentionally.

      --
      Ezekiel 23:20
    4. Re:Well, don't do that! by roca · · Score: 4, Informative

      Mozilla has run a very large-scale C++ project for many years, with an elite team of developers. Mozilla makes extensive use of enormous test suites, static checkers, Valgrind, ASAN, TSAN, etc. Mozilla created Rust because we concluded C++ was not reliable enough or secure enough for large-scale multithreaded applications.

    5. Re:Well, don't do that! by TheRaven64 · · Score: 3

      Mozilla has run a very large-scale C++ project for many years, with an elite team of developers

      If you've ever looked at the Mozilla code base, then you'd be a lot more reluctant to describe their team of developers as 'elite'. The most positive thing I can say about it is that it's not as bad as OpenOffice.

      --
      I am TheRaven on Soylent News
    6. Re:Well, don't do that! by roca · · Score: 2

      I worked on it for years. Given the size and the age of the code, and the problem domain, it's not bad. As for "elite", well, almost any of Mozilla's C++ developers could get a job at Google/Facebook/Apple/Microsoft easily. Many have.

    7. Re:Well, don't do that! by Viol8 · · Score: 3

      "we concluded C++ was not reliable enough or secure enough for large-scale multithreaded applications."

      That should have been "we concluded multithreading was not reliable enough or secure for large scale applications".

      When your browser switched from multiprocess to multithreaded back in the day (presumably to make it easier to port to windows) its reliability went down the toilet. Now you're making a big deal about going back to multiprocess. Well whoop-de-doo.

      There is nothing wrong with C++ for large scale applications , in fact that was one of its design ideals.

    8. Re:Well, don't do that! by Viol8 · · Score: 1

      " Large ones have pre-push hooks that run static checkers that enforce rules like no bare pointer and no operator new / delete."

      Yeah, right. And unicorns write these hooks while riding moonbeams in their spare time.

      The projects YOU have worked on might have done so, I've been on dozens that didn't.

    9. Re:Well, don't do that! by Anonymous Coward · · Score: 0

      That's fine in a language like Erlang, which doesn't allow mutable shared state (in Erlang, the only mutable object is the process dictionary, which cannot be shared)

      ETS

    10. Re:Well, don't do that! by Anonymous Coward · · Score: 0

      In Golang you typically use goroutines for concurrency and share data by communicating using channels. In most cases, this is what you want to do, ie. as a linear way to break down workloads among several workers and similar patterns. When sharing data as communication, you hand over the data itself, not pointers. There's no problem defining your own immutable types if you don't trust "yourself", though the "Go way" strives for more simplicity, so shouldn't really be necessary. If data is truly immutable (ie. not mutated), there should be even less problems. In the end it all comes down to trust and allowing some time for more simplicity (not popular with sweatshop-programmers/manager-types).

      Sometimes, a problem may require locks, mutexes and similar operations that may introduce race conditions, deadlocks and what have you. Point is when you can avoid such patterns, you may be better off, though simpler not always the best solution for more complex problem domains.

      Golang is actually a niche language, so structs in memory are layed out as in C/C++ and you have a bit more direct control, plus safe non-arithmetic pointers, bounds-checking and concurrent GC in place. It's a systems building language, so more meant to replace C/C++ than Python/Java/Ruby, though progressing in areas dominated there as well.

      My biggest pevees with Golang is lack of context in errorhandling (full stack trace from error-generating code), a huge win for Java 20 years ago. Other than that, it's my go-to language for everything I need, from shell-scripting to back-end/system-tools programming, though not yet optimized for front-end and games programming, some people are doing that too.

      A post is too little space to provide full credit. Start by doing the "Golang tour" and see a few videos by the original creators of golang. It's more than worth it!

    11. Re:Well, don't do that! by Anonymous Coward · · Score: 0

      It seems to me as though you only looked at it once, years ago. Their codebase has been drastically improved from the "very solid... by 1999's standards" feel it had just 2 years ago. Mozilla is quite successfully adapting a very old codebase into a modern one, and it's slipping past the notice of people who don't really know or understand the challenges involved. As someone who has been involved in projects like this, I can guarantee you that the work Mozilla does is vastly underrated by the peanut gallery on sites like Slashdot.

      Mozilla is taking this very seriously, their code quality is not at all stuck in the past or of low quality overall, and they're actively refactoring it to get rid of the worst bits (in fact the only reason they have not done so sooner is because of legacy code compatibility - something that the same peanut gallery is so hesitant to lose). Even WebKit and Blink have been showing their age over the past 2 years, and are starting to have serious legacy issues crop up as well. If people are going to judge Mozilla's much older code by harsh standards, they should learn to apply those same standards to other projects without such biased eyes.

    12. Re:Well, don't do that! by K.+S.+Kyosuke · · Score: 1

      When sharing data as communication, you hand over the data itself, not pointers.

      A pointer itself is a datum. As far as I'm aware, this case is accounted for and expected to work. So as long as only one goroutine mutates some shared (*) structure and sending the pointer is acknowledged as relinquishing control over it, all should be fine. But I'm not a Go-ist so my perceptions may have been wrong, of course.

      (*) Shared over the lifetime of a process, *not* being accessed simultaneously from multiple goroutines at once.

      --
      Ezekiel 23:20
    13. Re:Well, don't do that! by Anonymous Coward · · Score: 0

      > A pointer itself is a datum.

      Yes, but it's metadata. It doesn't convey any message except where the data can be found.

    14. Re:Well, don't do that! by K.+S.+Kyosuke · · Score: 1

      "we concluded C++ was not reliable enough or secure enough for large-scale multithreaded applications."

      That should have been "we concluded multithreading was not reliable enough or secure for large scale applications".

      Funny how that hasn't been a problem for enterprise Java, heh? You get thousands of threads on Azul boxes with parallel GC and everything turns out to work just fine. It's almost as if C++ were the problem...

      --
      Ezekiel 23:20
    15. Re:Well, don't do that! by K.+S.+Kyosuke · · Score: 1

      I'm pretty sure there is very little distinction between a pointer and an integer on the CPU level. At least in non-tagged architectures.

      --
      Ezekiel 23:20
    16. Re:Well, don't do that! by Anonymous Coward · · Score: 0

      At the CPU level, it's more about where, not what. A pointer will typically go into an address register before dereferencing, if the architecture has such a thing.

    17. Re:Well, don't do that! by Viol8 · · Score: 1

      C++ isn't the problem - when you use threads with it you either use pthreads which are a thin layer on top of the OS threading subsystem or more recently C++ threads which are ditto since its a systems programming language first and foremost that can also be used to develop applications.

      Java is an purely an applications programming language and so is higher level and abstracts its threading away from the OS and doesn't even have to use OS threads at all.

    18. Re:Well, don't do that! by Viol8 · · Score: 1

      Oh, and FWIW , java's multi process handling and job control is an absolute joke.

    19. Re:Well, don't do that! by david_thornley · · Score: 2

      If you can't enforce simple rules like that, your project is in serious trouble, no matter what language it's written in. Every language has its infelicities, and if you can't keep programmers away from them by whatever means you're not writing good software.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    20. Re:Well, don't do that! by angel'o'sphere · · Score: 1

      C++ has no multi process handling or job control either, so what is your point?

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    21. Re:Well, don't do that! by Anonymous Coward · · Score: 0

      any of Mozilla's C++ developers could get a job at Google/Facebook/Apple/Microsoft easily. Many have.

      A meaningless comparison. Fresh-out-of-school Java grads can get jobs at those places. Wake me up when they could get a job at a AAA game developer that only works in C++.

    22. Re:Well, don't do that! by Anonymous Coward · · Score: 0

      ... almost any of Mozilla's C++ developers could get a job at Google/Facebook/Apple/Microsoft easily.

      Not really helping your argument...

    23. Re:Well, don't do that! by Viol8 · · Score: 1

      It can use the posix multiprocess API. Good luck trying that with java.

    24. Re:Well, don't do that! by Viol8 · · Score: 1

      Or perhaps the programmers you've worked with weren't good enough to handle them to had to be prevented from using them. A good workman doesn't blame his tools.

    25. Re:Well, don't do that! by david_thornley · · Score: 1

      There are constructs in C++ that you should just avoid in almost all cases. If programmers are using them constantly, they're bad programmers. All computer languages are tools and none are perfect. C++ is the Swiss Army chainsaw of languages.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    26. Re:Well, don't do that! by mfnickster · · Score: 1

      There are constructs in C++ that you should just avoid in almost all cases.

      I gave a friend of mine a copy of K&R with the title crossed out, and "C++: The Good Parts" written in!

      --
      "Slow down, Cowboy! It has been 3 years, 7 months and 26 days since you last successfully posted a comment."
    27. Re:Well, don't do that! by angel'o'sphere · · Score: 1

      Well, I don't want to nitpick ...

      I guess you mean the Posix multithreading API? That has no job control and does not work on processes.
      Then again, via JNI or JNA I can use any C library in Java ... so if I was brain dead I could use the POSIX Multithreading library.

      However multithreading in Java is so easy that it is basically the leader in the industry for multi threaded software.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    28. Re:Well, don't do that! by david_thornley · · Score: 1

      Most of the "avoid" stuff is left over from C. If there were no C-style strings or arrays, C++ would be a better language. If it wasn't for the difficulties in parsing C, C++ could compile much faster. In C, you have to do your own memory management. In C++, it's almost always optional.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    29. Re:Well, don't do that! by Viol8 · · Score: 1

      No, I mean the posix multiprocess API. You know, functions like fork(), exec(), wait(), kill() etc.

      Perhaps you should educate yourself on the difference between processes and threads before replying again. And no, you couldn't use pthreads in java effectively because it requires types that java doesn't support natively and if you try and fork off a JVM from within java you're probably in for a world of pain as all internal file handlers, signals, semaphores etc are duplicated which are easy to deal with in C/C++ but no in a language that knows nothing about them.

    30. Re:Well, don't do that! by angel'o'sphere · · Score: 1

      Then your previous posts make no sense, as you can call all those functions from Java as well.
      Which you probably know :)

      Your explanations here make no sense either, of course you could use pthreads easily, however e thread would be in C/C++, which likely makes not much sense in a JVM.

      JVMs are just C/C++, of course they can fork ... why not? Does it make sense? No idea.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    31. Re:Well, don't do that! by Viol8 · · Score: 1

      Ok, you fork in java. How do you close the child JVM file descriptors? What about signals? Sockets? The JVM won't know its been forked and so won't act accordingly.

      No you couldn't use pthreads easily since there's more to using pthreads than just calling functions. Mutexs, attirbutes, rwlocks etc all need to be defined external to those functions using C typedefs which are not going to have a 1 -> 1 mapping with a java type. How to you plan on doing that from within a java program?

    32. Re:Well, don't do that! by angel'o'sphere · · Score: 1

      Sigh ... as soon as we do either fork or use pthreads, the rest will be in C/C++ and not in Java.
      So, we don't need any mapping from C to Java ... that would be pointless.

      Anyway, I only was nitpicking anyway as you glorified that Java has no "job control" and implied C had.

      Perhaps you want to look at a shell (e.g. Bash) or a true batch language like JCL to understand "job control".

      However: I would not know why you want to close the files of the parent. That does not make sense to me. The beauty of fork etc. is that the child inherits the file descriptors and can write to the same files (e.g. stdout) as the parent does without interfering.

      And then again: if you want to close them, you simply close them ... no idea what your problem is.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    33. Re:Well, don't do that! by Viol8 · · Score: 1

      "Sigh ... as soon as we do either fork or use pthreads, the rest will be in C/C++ and not in Java."

      Which goes back to my point that java doesn't support multiprocess - it has to use another languages API and even then it can't support it properly.

      "Perhaps you want to look at a shell (e.g. Bash) or a true batch language like JCL to understand "job control"."

      How do you think the shell does it you muppet, what language do you think its written in? Job control is nothing more than spawing child processes, creating pipes between them, controlling the suspension and resumation of them using SIGTSTP, SIGCONT and reaping them when they exit. Most of which you can't do in Java.

      "no idea what your problem is."

      Clearly. It seems the difference between java file descriptors and the descriptors, handlers etc internal to the JWM which the java program knows nothing about is confusing you, but don't worry about it. Stick to your sandboxed JWM and let others worry about systems programming. Over and out.

    34. Re:Well, don't do that! by Anonymous Coward · · Score: 0

      If you believe that roca hasn't looked at the Mozilla code base, you are deeply mistaken.

    35. Re:Well, don't do that! by Anonymous Coward · · Score: 0

      Please have a look at Rust's design, and tell me that it doesn't make writing correct multi-threaded code easier than C++. Rust's concept of "borrowing" is a huge step forward (as compared to C++) in expressing the sharing semantics in multi-threaded code.

      A good starting point for understanding borrowing, and how it helps write correct, maintainable, multi-threaded code is Fearless Concurrency With Rust.

  10. Odd statement from a professional programmer by Anonymous Coward · · Score: 0

    Languages are merely a palette from which to work.
    Our job is to elegantly use the tool available to create a solution.

    I kind of like the challenge of creating beautiful code in any language.

  11. He is right by Anonymous Coward · · Score: 0

    go is the way to go. Java is good, but is very boiler-platey ... C++ is just a mess. There are no real memory management tools ... and there are just too many shoe-horned things ..

    1. Re:He is right by SuperDre · · Score: 2, Insightful

      You mean to say, I don't know how to handle memory management and go does is all for me, without me knowing what it actually does, but it seems to work......... Oh please, Go is just Yet Another Programming Language which wasn't really necessary, but purely because some devs just didn't like other languages (or didn't know how to handle them properly).

    2. Re:He is right by friesofdoom · · Score: 1

      Amen!

    3. Re:He is right by Dutch+Gun · · Score: 2

      C++ is just a mess. There are no real memory management tools

      Yeah, except for smart pointers + RAII and the ability to override global, per-class, or even per-object allocators and add whatever sort of memory tooling you can dream up. Other than that, no memory management tools.

      --
      Irony: Agile development has too much intertia to be abandoned now.
    4. Re:He is right by K.+S.+Kyosuke · · Score: 1

      And as Grace Hopper would have said, the beauty of all these C++ tools are that there are so many to choose from!

      --
      Ezekiel 23:20
    5. Re:He is right by Anonymous Coward · · Score: 0

      I don't actually like C++, but at least C++'s tools work for ALL resources. Java handles memory for you but leaves you hanging for almost anything else like files, sockets, ... And since so many Java programmers have no experience (in addition to no tools) to handle resources many Java programs have huge issues with leaked file handles and when you report bugs on it there is a real risk of getting facepalm responses like "leaks are not possible in Java" (and yes, from "professional", employed developers).

    6. Re:He is right by K.+S.+Kyosuke · · Score: 1

      but leaves you hanging for almost anything else like files, sockets

      Don't lambdas in modern Java allow equivalent APIs to dynamically-scoped contexts in Lisp/Scheme etc.? Things like WITH-OPEN-FILE should be implementable this way, since they're basically equivalent to destroying a stack-allocated object with the proper destructor.

      --
      Ezekiel 23:20
    7. Re:He is right by TheRaven64 · · Score: 2

      Java doesn't guarantee anything with regards to timeliness of object destruction. A small object that just encapsulates a file descriptor may never be collected (until program exit - I think Java requires all objects are collected on program exit), and so its finaliser may never run and free the file handle while the program is executing. The same applies to closures - they're just objects and are not guaranteed to be deallocated.

      --
      I am TheRaven on Soylent News
    8. Re:He is right by chrism238 · · Score: 1

      Umm, you mean as Andrew Tanenbaum would have said? https://en.wikiquote.org/wiki/...

    9. Re:He is right by Anonymous Coward · · Score: 1

      Java doesn't guarantee anything with regards to timeliness of object destruction. A small object that just encapsulates a file descriptor may never be collected (until program exit - I think Java requires all objects are collected on program exit), and so its finaliser may never run and free the file handle while the program is executing. The same applies to closures - they're just objects and are not guaranteed to be deallocated.

      Actually, not even on program exit. Memory in use will be freed of course, but there's no guarantee the finalizer will run at all.

    10. Re:He is right by K.+S.+Kyosuke · · Score: 1

      There are so many people you can choose from here! ;)

      --
      Ezekiel 23:20
    11. Re:He is right by K.+S.+Kyosuke · · Score: 1

      That's why I mentioned dynamic-extent control flow feature use, instead of the indefinite-extent memory management. The purpose of the closure in such APIs (such as DYNAMIC-WIND in Scheme) is not in its lifetime but rather in its callability by the API when the scope is being exited (or re-entered, in case of Scheme, but not in Java since it doesn't have continuations). You're not relying on GC here but rather on control flow. This is not about object collection or finalizers, and I'm assuming the closure is written in such a way that its collection time is not critical. As a non-javist, I can't tell you the exact implementation of this in Java or where it is or isn't in the standard library yet, but it's no black magic in principle if you have callable blocks of code.

      --
      Ezekiel 23:20
    12. Re:He is right by Anonymous Coward · · Score: 0

      Java's try-with-resources is equivalent to WITH-OPEN-FILE. Acquisition of resources implementing the AutoCloseable interface in try header are automatically closed at the end of the try block and before any catch or finally blocks.

      https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html

    13. Re:He is right by Anonymous Coward · · Score: 0

      I thought Ms. Hopper said, "Hey what's the deal with this moth?"

    14. Re:He is right by bgarcia · · Score: 1

      Oh please, Go is just Yet Another Programming Language which wasn't really necessary, but purely because some devs just didn't like other languages (or didn't know how to handle them properly).

      Some devs? Really? And other people mark this as insightful?

      Do your homework people. The "some devs" who developed Go include:

      • Ken Thompson. Perhaps you've heard of him? He invented Unix. He invented B, the immediate predecessor to C.
      • Rob Pike, another Bell Labs alum. He helped develop Unix, Plan 9, UTF-8, and X (the graphic system protocol).

      They had a specific goal in mind when they developed Go. They wanted to make systems development faster and easier, and able to scale to the kinds of systems used at Google. This isn't just defining a new syntax for the hell of it. A lot of thought was put into reducing compile times. A lot of thought was put into the tooling. The edit-compile-debug cycle is so much quicker with Go than for any other language. It really does help speed up development.

      --
      I'm a leaf on the wind. Watch how I soar.
    15. Re:He is right by K.+S.+Kyosuke · · Score: 1

      Ah, great, they added a syntax for that! If you didn't have pre-made syntax for that, though, you could use (or write) something like an equivalent of Scheme's CALL-WITH-{INPUT|OUTPUT}-FILE which is a function that accepts a closure (as opposed to Lisp's WITH-OPEN-FILE which is a macro that executes a body of statements in a context where a file is open). But closures were apparently added in Java 8 and this exists since Java 7, so people are probably already used to that syntax.

      --
      Ezekiel 23:20
    16. Re:He is right by angel'o'sphere · · Score: 1

      (until program exit - I think Java requires all objects are collected on program exit)
      No it does not.
      Why would it?
      That would be completely pointless, and how exactly do you "collect" an object that still is referenced at the moment the program "exits"?

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    17. Re:He is right by Anonymous Coward · · Score: 0

      You think Ken Thomson, one of go's creators, who was also s a major contributor in the creation of Unix and C, "doesn't know how to handle" C?

      I'm not defending Go, as I have no experience with it. One friend, whom I trust, told me he tried it and didn't see what the big deal was. But Ken Thomson is still a giant in the field, and I'm pretty confident he can handle C. He wrote most of the original Unix programs! You probably use programs he wrote (in C!) every single day.

      HIs code from the original Grep and regular expression pattern matching is beautiful C code.

    18. Re:He is right by Anonymous Coward · · Score: 0

      GH also said sex with Bjarne was disgusting.

    19. Re:He is right by Anonymous Coward · · Score: 0

      What the GP meant was "C++ is just a mess: Too many memory management tools". Instead of worrying about malloc and free, you worry about what type of smart pointer to use (shared? weak? unique? auto?), who owns the pointer, copy constructors, move constructors, new placement new, delete, RAII, and got forbid you should start using lambdas.

      Seriously, once you start combining RAII with lambda captures who knows what happens. What happens when you need to capture a collection of objects that don't have copy constructors? What order will the captured objects be destructed in?

      dom

  12. Vectorization by shatteredsilicon · · Score: 3, Interesting

    The big problem when it comes to using anything other than Fortran, C or C++ is that 20 years after the first MMX and SSE instruction sets have been added to CPUs, there are only a handful of compilers that known how to vectorize even loops that are hand-crafted to be vectorizable - and the ones that can do it are all commercially licenced (GCC might theoretically have some support for it, but in reality it doesn't vectorize most things). And since most of the performance advancement in silicon has for a long time now been focused in SIMD units, that means that for any performance sensitive workload there are no feasible alternatives. If it has taken GCC 20 years to get not very far, how long will be be before much younger compilers get anywhere with this performance critical feature?

    1. Re:Vectorization by Anonymous Coward · · Score: 2, Informative

      GCC can vectorize pretty well.

      You may have to give it some hints and be careful how you code your loops but it works. See this article. https://locklessinc.com/articles/vectorize/

      That was using GCC 4 some years ago. I have not checked but I'd wager it's even better now.

      Clang/LLVM also does a good job of vectorization.
       

    2. Re:Vectorization by shatteredsilicon · · Score: 4, Informative

      I tested this extensively, including quite recently, and unfortunately where intel's C compiler as far back as 2008 produced excellent results (all the loops in my code vectorized even back then), GCC to this day fails to vectorize most of them. last time I tried with clang (last year), it fared even worse than GCC.

    3. Re:Vectorization by K.+S.+Kyosuke · · Score: 1

      I'd think that using something like OpenMP 4.x would be more productive for such code. Anyway, C(++) is still piss-poor when it come to ease of vectorized execution, certainly compared to something like APL.

      --
      Ezekiel 23:20
    4. Re:Vectorization by Anonymous Coward · · Score: 0

      GCC/clang don't even manage to "vectorize" initializing a chunk of memory (like a class).
      The most certainly don't manage to consistently vectorize a loop. That you happened to get lucky once and it happened to work doesn't contradict that it's generally crap and almost never works in reality. There is even a very good chance that its incompetent attempts at vectorizing will slow down your code overall.

    5. Re:Vectorization by shatteredsilicon · · Score: 1

      Intel compiler suite knows both how to vectorize (for inner loops) and parallelize (for outer loops). What you are referring to here with OpenMP is parallelizing, which is great. But you will still get 4x+ (depending on the CPU) of performance overall if the inner loops are vectorized. If it means you can get the same performance with 4x less hardware, that can make a huge difference to the cost and viability of a project.

    6. Re:Vectorization by TeknoHog · · Score: 4, Interesting

      Agreed, but I'd like to take a step back. IMHO, it is idiotic to first write a loop and then vectorize it -- we should have vector types to begin with. We've had them in Fortran for over 20 years, though not necessarily in all compilers as you point out (I remember using a nice SIMD-aware commercial compiler back in 2001). Today, you can use Julia as a modern replacement of Fortran with a free compiler, though you may need to give the @simd hint in some cases.

      I guess my physics background shows here. When we manipulate vectors in physics, we generally don't think of looping over all components sequentially; the components are a matter of representation, while the physical vector concept is independent of the coordinate system. Vectors also come with certain assumptions of independent operations per component.

      Your post is also a good reminder to the folks who laud C's ability to work at the low level; in my impression, C was designed to act like a very simple processor, so as real CPUs become more complex, the low-level idea gets ugly with backward constructs like loop vectorization. To effectively deal with SIMD etc. you need a higher-level perspective of vectors/matrices, as paradoxical as that may seem.

      Similar issues apply to multiprocessor systems, which have also been used in the scientific/HPC field for decades. So it's funny how it suddenly becomes completely new and hard to program for, when the same tech is sold to the general public in the form of multi"core" systems.

      --
      Escher was the first MC and Giger invented the HR department.
    7. Re:Vectorization by K.+S.+Kyosuke · · Score: 1

      That's exactly why I mentioned OpenMP 4.x, specifically,

      --
      Ezekiel 23:20
    8. Re:Vectorization by Anonymous Coward · · Score: 0

      I was just about to mention Julia, but you beat me to it.

    9. Re:Vectorization by dabadab · · Score: 1

      Similar issues apply to multiprocessor systems, which have also been used in the scientific/HPC field for decades. So it's funny how it suddenly becomes completely new and hard to program for, when the same tech is sold to the general public in the form of multi"core" systems.

      It shows that you are not a programmer.
      In HPC applications you have workloads that are basically embarrassingly parallel and it's very easy to spread them out to n cores. On the other hand with desktop applications the parallelism is not so apparent and all the threads try to use the same data leading to a much more chaotic behaviour. Of course the latter is a lot more harder to handle - it would be a miracle if it were not.

      So it's not about if it's solde to the scientific field or the general public but the nature of the paralllelism.

      --
      Real life is overrated.
    10. Re:Vectorization by odysseus_complex · · Score: 1

      It's also good to remember that C was not designed for general application writing; it was designed to write low-level controllers and operating systems and to be a portable assembly language. This is what most people forget when they laud or lament C.

      What I see as the most problematic aspect of C is the refusal of the ISO committee from keeping up with hardware changes. We still, as you have noted, do not have standardized SIMD primitives or access to common SIMD operations (fuse-multiply-add, for example). They finally added the __thread (a valid hardware/OS construct) attribute but only years after all the compilers had it and developers were using it. Unfortunately that same committee also decided to add a threading model to C on which Poul-Henning Kamp wrote a scathing report.

      So to wrap up, remember the purpose of C and keep it doing that purpose.

    11. Re:Vectorization by Anonymous Coward · · Score: 0

      Well, sort of... C was created for systems programming in Unix, true, but within 5 years it was clear that it was suited to programming apps, utilities, etc. and started evolving in that direction.

      I don't know why people keep calling it a 'portable assembler,' since it has none of the features of an assembler (1-instruction-per-line, machine specific, register-level access) and wasn't very portable at first. I can't find any definition of 'portable assembler' that fits C but not every other compiled HLL as well. :-P

  13. Indeed. C++ is a better C by Anonymous Coward · · Score: 5, Interesting

    Take the low-level access provided by C, and then add the ability to construct both compile-time and run-time abstractions to an incredibly high level, but with as little cost as possible. That's C++.

    C++ is an amazing achievement.

    Every academic language approaches Lisp, but every practical language (you know, the ones that actually make the world turn) approaches C++; Bjarne said as much, and he was right.

    1. Re:Indeed. C++ is a better C by TheRaven64 · · Score: 4, Interesting

      C++ has improved a lot, but there's still one place where it lags behind something like Lisp: you have to decide between compile-time and run-time specialisation very early. Constexpr functions were a big step in the right direction here, letting you move between compile-time and run-time computation without shifting syntax, but there's still no equivalent for data. If you want to do compile-time specialisation, you use templates, if you want to do run-time specialisation then you use fields. If you picked one and now want to move to the other, then it's very difficult to refactor, and if you want either compile-time or run-time specialisation in the same object for different uses then it gets clunky very quickly.

      --
      I am TheRaven on Soylent News
    2. Re:Indeed. C++ is a better C by The+Evil+Atheist · · Score: 2

      That's exactly the reason why I prefer C++ over Lisp. I've tried learning Lisp many times. The thing that got me every time was when macros were run. Templates and constexpr doesn't have that problem, and they're also hygienic, by definition. You know precisely when they run, and you get a compile error when they can't. The only way I could get my head around List Processing patterns was through metaprogramming with variadic templates, and that was because, despite the scary error messages, you can actually figure out exactly where you went wrong.

      You can easily get a sense of what you know at compile time, and what you don't.

      --
      Those who do not learn from commit history are doomed to regress it.
    3. Re:Indeed. C++ is a better C by Gravis+Zero · · Score: 1

      Constexpr functions were a big step in the right direction here, letting you move between compile-time and run-time computation without shifting syntax, but there's still no equivalent for data.

      yes, there is: http://en.cppreference.com/w/c...

      --
      Anons need not reply. Questions end with a question mark.
    4. Re:Indeed. C++ is a better C by TheRaven64 · · Score: 2

      Okay, so how in C++ would you implement a variation on std::array that lets you select per use whether the size is a compile-time constant or a field that is set in the constructor?

      --
      I am TheRaven on Soylent News
    5. Re: Indeed. C++ is a better C by Zero__Kelvin · · Score: 0

      That's not the only problem either . .. How do you have an object that is garbage collected and not garbage collected at the same time! C++ is the suxors!

      --
      Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
    6. Re: Indeed. C++ is a better C by TheRaven64 · · Score: 2

      I'm not sure what point you're trying to make. It is very common to have an object where you want compile-time specialisation for some common (or hot-path) cases, but want a generic version for other cases, and want to share the implementations. Having an object that is both GC'd and non-GC'd at the same time seems like an odd requirement, though MSR had a paper at PLDI providing memory-safe manual memory management in the .NET context, where objects could be explicitly deallocated and would eventually be collected, so if you used a dangling to them you'd get an exception. Perhaps that what you want?

      --
      I am TheRaven on Soylent News
    7. Re:Indeed. C++ is a better C by jcr · · Score: 4, Interesting

      C++ is an amazing achievement.

      You really need to get out more.

      C++ is a steaming pile of needless complexity. I blame Stroustrup for his inability to say no whenever anyone came up with yet another feature to toss onto the dungheap.

      The best thing about C++ is that you don't have to use all of it.

      -jcr

      --
      The only title of honor that a tyrant can grant is "Enemy of the State."
    8. Re:Indeed. C++ is a better C by Anonymous Coward · · Score: 1

      You *do* realize that being "behind something like LISP" for time sensitive programming is about as meaningful as "having more feminism than Sharia Law" ?

      Garbage collection is *not your friend* for anything that has to handle time sensitive data processing, And yes, I learned it from Sussman at MIT.

    9. Re:Indeed. C++ is a better C by lucasnate1 · · Score: 3, Insightful

      C++, like C, like UNIX, is an amazing achievement with lots of mistakes. Hell, Windows NT managed to replace UNIX to some extent, but nothing really managed to replace C++ and C.

    10. Re:Indeed. C++ is a better C by Jamu · · Score: 2

      You can use a template with a type parameter that indicates if the size is compile-time or runtime. Eigen takes this approach with matrices.

      --
      Who ordered that?
    11. Re:Indeed. C++ is a better C by Anonymous Coward · · Score: 0

      Please point out the needless compexity. Now point out why learning a new language each year is a better idea.

    12. Re:Indeed. C++ is a better C by PoopJuggler · · Score: 1

      Default. Template. Arguments.

    13. Re:Indeed. C++ is a better C by TheRaven64 · · Score: 1

      I've taken that approach, but it's very clunky and, importantly, it's hard to retrofit to a class where you initially made the decision one way or another (or the natural choice when first implementing a class). It feels like the way that you did compile-time computations in pre-C++11 days via templates. I would love to see something to make this more natural.

      --
      I am TheRaven on Soylent News
    14. Re:Indeed. C++ is a better C by K.+S.+Kyosuke · · Score: 1

      Take the low-level access provided by C, and then add the ability to construct both compile-time and run-time abstractions to an incredibly high level, but with as little cost as possible. That's C++.

      Or, take the high-level access provided by Lisp, then add the ability to construct both compile-time and run-time abstractions to an incredibly low level, but with as little cost as possible (AND including on-the-fly compilation for adapting your program to particular data inputs, which C++ can't). That's Chez Scheme.

      --
      Ezekiel 23:20
    15. Re:Indeed. C++ is a better C by K.+S.+Kyosuke · · Score: 1

      What about RScheme? Also keep in mind that because of comparatively little interest in similar efforts (the embedded world is still quite happy with C/C++), not a lot of work was expended on such things anyway, so the lack of suitable implementation shouldn't be taken as a strong evidence of impossibility.

      --
      Ezekiel 23:20
    16. Re:Indeed. C++ is a better C by bzipitidoo · · Score: 2

      I've been complaining about a similar problem. Even with constexpr, it's still a pain to initialize complicated structures. What I end up doing is letting them be variables and computing their values first thing at runtime, though I wanted constants initialized during compile time. For instance, I might have the data all specified in YAML, then use a YAML library function to load all that into the program when it starts.

      Here's a simple JavaScript example of the sort of thing I mean. Suppose I want a list of the elements. Using just the first 8, I could have: const ELEMENTS=["-","H","He","Li","Be","B","C","N","O"]; or I could do this: const ELEMENTS="- H He Li Be B C N O".split(" "); I much prefer the 2nd way, for clarity of code, and I thought everyone would, but I've found not everyone was sold on that. The good part is that at least they're constants. The bad part is that it's initialized at runtime.

      Get more complicated, like, suppose I wanted an array of objects instead of strings, and each object is all the data about one element, the atomic weight, a list of isotopes and whether they are stable or what their half lives are, the full name, and so on, and it gets involved. Of course I'd want all that to be constant. If some of that data could be computed from other data at compile time, I'd prefer to do so, rather than do the calculations offline, so to speak, and plug the numbers in to the code. For instance, the atomic weight can be computed from the weights of the stable and long term radioactive isotopes and their percentages in nature, so why directly enter that value in the code and risk a mismatch from a typo? If the reason to take that chance is that the programming language pushed the coder into that compromise, then that's a deficiency in the language.

      --
      Intellectual Property is a monopolistic, selfish, and defective concept. It is "tyranny over the mind of man"
    17. Re:Indeed. C++ is a better C by Gravis+Zero · · Score: 1

      std::array is not data, it's a class. You are complaining about X and then pointing to Y.

      --
      Anons need not reply. Questions end with a question mark.
    18. Re:Indeed. C++ is a better C by DrXym · · Score: 4, Insightful
      Depends if you mean "replaced" in a binary sense because C and C++ have been utterly annihilated in a lot of problem domains, particularly middleware, business logic, web front ends, application development.

      All the domains where speed isn't the biggest deal and where reliability / uptime / portability / maintainability are more important. That's why languages like Java, .NET, Python, Ruby, JS have made headway.

      So where C/C++ tended to be all-encompassing, they're now relegated to performance critical areas where until recently there wasn't much choice. Kernels, embedded, systems services, games. Places where performance and/or memory footprint were critical.

      But even there choice is opening up. Rust in particular produces code, that is for all intents and purposes as fast as C/C++ but which tends to be safer, more portable and reliable. If you prefer to tradeoff some speed for programming niceties then you can go for Swift and Go too.

      If I were writing software from scratch these days I definitely consider other languages before C++. I might reject them for reasons but C++ and C would be the bottom of the pile.

    19. Re:Indeed. C++ is a better C by david_thornley · · Score: 3, Informative

      That's an awfully content-free posting to get (4, Interesting), given that it boils down to "I don't like C++ because it's complex". If you read Stroustrup's Design and Evolution book, you can actually find out why Stroustrup added what he did and rejected what he did.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    20. Re: Indeed. C++ is a better C by Anonymous Coward · · Score: 1

      ... You'd rather e were forced to explicitly call member destructors? When is skipping those even desired?

    21. Re: Indeed. C++ is a better C by Anonymous Coward · · Score: 0

      Key word being this destructor.

      I don't like when an "empty" function executes code I didn't write and can't see.

    22. Re: Indeed. C++ is a better C by Anonymous Coward · · Score: 0

      Using two template classes and conditional inheritance I think. I probably misunderstand what you want since this seems trivial...

    23. Re:Indeed. C++ is a better C by jcr · · Score: 0

      If you read Stroustrup's Design and Evolution book

      Yeah, I'll get right on that, as soon as I'm done with Michael Moore's weight loss book.

      -jcr

      --
      The only title of honor that a tyrant can grant is "Enemy of the State."
    24. Re:Indeed. C++ is a better C by jcr · · Score: 1

      "If you think C++ is not overly complicated, just what is a protected abstract virtual base pure virtual private destructor and when was the last time you needed one?" — Tom Cargill

      QED.

      -jcr

      --
      The only title of honor that a tyrant can grant is "Enemy of the State."
    25. Re:Indeed. C++ is a better C by PoopJuggler · · Score: 1

      Name a single language where you have to use all of it.

    26. Re:Indeed. C++ is a better C by Eunuchswear · · Score: 1

      Brainfuck.

      --
      Watch this Heartland Institute video
    27. Re: Indeed. C++ is a better C by HornWumpus · · Score: 1

      He could, if he really wanted to, C++ is happy to let you blow your own pecker off.

      People forget that constructors/destructors were once the 'modern OO way to do memory management'.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    28. Re: Indeed. C++ is a better C by Anonymous Coward · · Score: 0

      LOLOLOLOLOL. Got em.

    29. Re: Indeed. C++ is a better C by Anonymous Coward · · Score: 0

      You sound like a control freak.

    30. Re: Indeed. C++ is a better C by Anonymous Coward · · Score: 0

      You really don't see a problem with an empty function that does things??

    31. Re: Indeed. C++ is a better C by Pseudonym · · Score: 1

      To be fair, that was back in the day when OO was considered to be an advantage. My how times have changed.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    32. Re:Indeed. C++ is a better C by Pseudonym · · Score: 2

      It's usually considered a weakness of language design to disallow certain combinations of orthogonal features just because you can't see a use for those combinations.

      Imposing exceptions to rules makes a language spec more complicated, not less.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    33. Re:Indeed. C++ is a better C by jaa101 · · Score: 1

      The best thing about C++ is that you don't have to use all of it.

      Unless you're working on other people's code, in which case you have to understand all the parts of the language they've used. And working on other people's code is the majority of programming work.

    34. Re: Indeed. C++ is a better C by Anonymous Coward · · Score: 0

      Totally other way around: short of bullshit pizza delivery apps, the world moves around Fortran written linear algebra routines. Perhaps with a tiny glue of Python or R on top. Or may still be pure Fortran.

    35. Re:Indeed. C++ is a better C by Anonymous Coward · · Score: 0

      I blame Stroustrup for his inability to say no whenever anyone came up with yet another feature to toss onto the dungheap.

      There is a committee for that. Go see what they do, and how they do what they do. And watch out for the Boost the boogieman, the master of all new and exiting.

    36. Re: Indeed. C++ is a better C by Anonymous Coward · · Score: 0

      I read countless comments on the topic, and time and time again I "learn" some new buzzword of C++. Doing object oriented programming in C isn't that hard, any sophomore to the language can do it, and I say that as a lay person who doesn't use it for employment.

      You twats just can't see the big picture. You must constantly abstract and plan around the shortcomings of C++ instead of sucking it up and learning Go. It's sad because it's so easy to pick up if you already know C at a high level, but your minds have been perverted to such an extent with C++ you just can't wrap you mind around the simplicity.

      Simplicity is a good thing. That's why C will always be better than a bastard child language.

    37. Re: Indeed. C++ is a better C by loufoque · · Score: 1

      the fastest BLAS and LAPACK implementations are not written in FORTRAN.

    38. Re:Indeed. C++ is a better C by Anonymous Coward · · Score: 0

      >> C++ is an amazing achievement.

      > You really need to get out more.

      Yes, C++ is an amazing achievement because it brings safety and zero cost abstraction to C for free.
      People that criticize C++, are generally the ones that never took the time to learn it correctly.

      There is two types of system programmers :
      - The ones that uses C++11
      - The ones that are still debugging why their C99 macro bloat made more spicy with void* pointers segfault.

    39. Re:Indeed. C++ is a better C by david_thornley · · Score: 2

      Ah, so you'd prefer to keep ignorance for convenience in scoffing. Okay.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    40. Re:Indeed. C++ is a better C by jcr · · Score: 1

      you'd prefer to keep ignorance

      Go fuck yourself. I've had enough painful experience with Stroustrup's debacle to dismiss any pretense at competence in language design on his part.
      -jcr

      --
      The only title of honor that a tyrant can grant is "Enemy of the State."
    41. Re:Indeed. C++ is a better C by HuguesT · · Score: 1

      Hello JCR,

      QED nothing. This dates from 1990 and has completely failed to deter millions of people to learn the language. Now Tom Cargill could put together some extra words involving templates and meta programming, which would still prove nothing.

      In plain english you can make sentences that are legal grammatically but have no sense. This is an instance of a feature in a computer language that exists, is legal, and that has no recorded actual use. So?

    42. Re:Indeed. C++ is a better C by michael_wojcik · · Score: 1

      All extant real Brainfuck implementations have finite-size cells, so unless the implementation specifically traps wrapping, you can dispense with either the increment or decrement operator. Similarly, many have fixed-length tapes, which let you omit either move-right or move-left.

      Unlambda is another tarpit language with a bunch of syntactic sugar for the lazy programmer. (Who needs i when you have ``skk? No one, that's who.)

      Even ETA programs could really get by without E.

      I'm sure there's at least one tarpit language that needs every feature to be Turing-complete, though.

    43. Re:Indeed. C++ is a better C by jcr · · Score: 1

      People that praise C++ are those who have a misplaced pride in memorizing minutia that decent languages don't have.

      -jcr

      --
      The only title of honor that a tyrant can grant is "Enemy of the State."
    44. Re:Indeed. C++ is a better C by david_thornley · · Score: 1

      And we're still at your subjective opinion, which disagrees with the opinions of a great many highly competent people.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    45. Re:Indeed. C++ is a better C by jcr · · Score: 1

      Protip: your argumentam ad veracundiam is probably lot more persuasive on people who haven't had direct personal experience of what a steaming pile C++ is. Been there, done that, won't do it again.

      -jcr

      --
      The only title of honor that a tyrant can grant is "Enemy of the State."
  14. Re:Provided you have infinite hardware resources.. by JaredOfEuropa · · Score: 4, Insightful

    Anything that allows us to reduce errors, increase functional complexity, reduce development time, improve readability and maintainability, and/or make it easier to code for a greater amount of people, is progress in my book. Working at a higher abstraction level achieves some or all of those goals.

    And good frameworks help with that. When I build a house, I don't want a craftsman who takes time to learn how to use an adze so he can plane down lumber to the correct size for the job; I want a builder who knows he can get lumber of the correct dimensions right at the store. The skills to build instead of buy are useful in many trades (both building and programming), but they are expensive and a possible source of additional errors. Frameworks are often a good answer to that... as long as the developer understands the nature of the framework, its limitations, the licensing model, its viability, and thus can assess the consequences of using it.

    --
    If construction was anything like programming, an incorrectly fitted lock would bring down the entire building...
  15. 20% slower!???? Are you INSANE!!!!!!111???1111!!! by Anonymous Coward · · Score: 0

    I'd like that stolen battery life back please, you Code Monkey.

    You must wait a little bit before using this resource; please try again later.

    OK... whips open Tor...

  16. Hasn't Ada fixed all of this decades ago? by butzwonker · · Score: 4, Interesting

    What I find kind of annoying is that Ada fixed all these flaws decades ago with Ada 95, now it is at Ada 2012 and still gets no love, just because it's a bit more verbose than C if you use it correctly. (Though not necessarily more verbose than C++.) Sure it has some flaws, e.g. concerning aliases and their scoping rules, but these are mostly inconveniences and some of them have been fixed in Ada 2012. But it doesn't stop there, the same story can be said about dynamic languages. Take fancy new dynamic language X and you can be fairly certain that CommonLisp solved all the problems of the new language already in the 80s.

    Maybe developers are in the end less rational than they think? It seems to me that a language must have serious flaws, lots of incoherent shortcuts and tricks, or at least a cryptic syntax to become really successful.

    1. Re:Hasn't Ada fixed all of this decades ago? by Anonymous Coward · · Score: 1

      Well, for embedded you'd kinda want to use a language that can be compiled to your architecture and C is supported for all of them.
      For web you kinda want to stick to Ecmascript for obvious reasons.

      Put sure, if you want to write command line tools then there are many languages that are better than C and C++.

    2. Re:Hasn't Ada fixed all of this decades ago? by roca · · Score: 1

      No, Ada in practice doesn't have memory safety or thread safety. For high-assurance stuff like avionics you can avoid those problems with theorem proving or by sticking to an extremely limit language subset that e.g. forbids dynamic heap allocations ... but that is not practical for large applications.

    3. Re:Hasn't Ada fixed all of this decades ago? by johannesg · · Score: 1

      Though not necessarily more verbose than C++.

      What on Earth makes you think C is less verbose than C++? In C, you have to manually, painstakingly free every resource, while C++ does it all for you. In C, you are checking for errors on every single function invocation throughout your program, while C++ requires only a handful of strategically placed try/catch blocks. In C, dealing with strings or dynamic arrays is a source of endless pain and misery, but C++ makes it a snap - and gets all the resource allocation right as well, without even having to think about it. And let's not even get started on anything more complex than that, like hashmaps: C has you casting, checking for errors, and clearing up resources throughout the length and width of your program, while C++ makes it safe, effortless, and completely pain free.

      And in those cases where C++ looks more verbose than C, it is actually doing stuff C will not do for you in the first place.

    4. Re:Hasn't Ada fixed all of this decades ago? by Anonymous Coward · · Score: 1

      It is possible to use SPARK, the version of Ada that has theorem proving as part of its definition, selectively in large applications and gain those benefits. It will likely surprise programmers how much of the code can fit into the "subset". The advantages of using a language that helps prevent many typical programming errors should not be overlooked.

    5. Re:Hasn't Ada fixed all of this decades ago? by Anonymous Coward · · Score: 0

      Ada Gets no love because Ada => AdaCore => $$$.
      Costs so high you have to "contact us for pricing."

    6. Re: Hasn't Ada fixed all of this decades ago? by Reverend+Green · · Score: 1

      Same reason few ever gave much attention to Eiffel.

    7. Re:Hasn't Ada fixed all of this decades ago? by Anonymous Coward · · Score: 0

      Ah, try/catch, the fastest way to make a program that doesn't do what it should without crashing.

    8. Re:Hasn't Ada fixed all of this decades ago? by Anonymous Coward · · Score: 0

      Delighted to see somebody else seeing things like this, both regarding ada and commonlisp. Most of the new languages (R,python,js,java) are elements of the two combined with some fashionable syntax. However, they are rarely stable and well implemented. Ada are well supported and, above all, well standardised. Also, there is the new Spark that adds automatic correctness prooving to an Ada subset (this doesn't mean that the resulting programs are 'correct' but that it is more likely to catch bugs early and not have to debug concurent, non-deterministic processes). But, for some reason that I will not understand, they will remain mainstream only in a few restricted communities. At least for some time.

    9. Re:Hasn't Ada fixed all of this decades ago? by mandolin · · Score: 2

      I used Ada circa 1997 for a DoD project.

      Ada felt like industrial-strength Pascal. It was generally cool -- why *wouldn't* I want the compiler to range-check array index operations by default, at least for non-critical code paths? This could help me today, on *real problems*. Why *wouldn't* I want an enforced, specified order of initialization for global/static objects? I also strongly preferred the generics and exception syntax over their C++ equivalents. Ada's OS-agnostic task support was ahead of its time (hard for the language to support threads when the underlying OS doesn't).

      Going back to C afterwards felt like returning to something ... primitive. But, I develop in C++ today.

      Ada had historical issues and feature lags, some of which still plague it today, such as:
      -- historically, no free compiler (today, there is FSF GNAT)

      -- the object.method() - style syntax didn't show up until 2005; standardized bitwise operations didn't show up until 1995

      -- small standard library, which in general has lagged behind even what C++ supports. Containers didn't appear until 2005. Also, AFAIK Ada still has no equivalent of say, C++'s Boost or Rust's crates.io (though there are at least some Ada projects and libraries on Github). Want to call epoll() directly on Linux? In C++ you can use it directly; in Rust you can find a wrapper, in Ada you need to roll your own (to be fair, Ada's C interface support is excellent). Want standardized smart pointers? Maybe in Ada2020. If you want to make Ada more popular, I think this general problem of "I have to write my own version of xyz" is the single most important thing you could tackle.

      -- Some things are just relatively awkward to express in Ada, even beyond the normal verbosity of the language (some of which there are good reasons for). Here for example is a comparative look at closures. As another example, C++'s operator overloading is ripe for abuse, but it also enables a nice abstraction of, say, bignums or half-precision floats. AFAIK Ada has nothing like that. To be fair, you can make this criticism about any language for a given feature that might be important to your problem domain.

    10. Re:Hasn't Ada fixed all of this decades ago? by Anonymous Coward · · Score: 0

      It's simply a question of perception, marketing, and ego.

      You're absolutely correct -- reviving and improving Ada would have been a better use of humanity's resources than creating Rust. Ada's reputation suffers from its historical connection to the US military and huge boondoggle projects, much in the same way that Lisp is still tainted from the "AI winter" period. Ada also has a paucity of free tooling available, and we're now in an era of free developer tools being the standard.

      Those problems can be overcome with effort, but it's much easier and more ego-gratifying to create your own language, which of course won't be bad like all that old stuff created by people who weren't as smart. Combine that with clever marketing (Rust has been very effective in promoting itself as "the only memory safe language") and getting adopted by a handful of high profile projects, and you can be internet famous forever!

    11. Re:Hasn't Ada fixed all of this decades ago? by mandolin · · Score: 1

      I don't think the following necessarily disagrees with your post, but I'd like to elaborate on it.

      I get the point that doing something "the C++ way" can be more verbose than "the C way", especially when one is writing a library. Whether it's the pimpl pattern, rule of 3 (now rule of 5), overloading every stupid arithmetic operator for a numeric class, defining const/non-const versions of a method, adding template sugar everywhere to your declarations if you're working on a template class, adding standard iterability to a class ... it all makes for some pretty stupid boilerplate.

      That said, while life is more complex for the class implementor, the class user's life is much simpler. C coders shouldn't have to (poorly) reimplement a std::vector subset every time they need a dynamically-sized array of something, nor should they have to sacrifice RAII. Since a class is usually used more often than it is written, it's a net C++ win.

      There are other corner cases (like printf() vs iostreams) where the C++ way looks more complex, but works with arbitrary types. I still resent needing to use io manipulators (don't forget to reset your state!) for stream operations when I am really just working with C types. I do understand there are libraries like Boost.Format that help with this; it irks me that they are not standard.

    12. Re:Hasn't Ada fixed all of this decades ago? by johannesg · · Score: 1

      True, but those are examples of C++ doing stuff C can't do to begin with. How would C deal with overloaded operators for a numeric class? You'll need separate functions, that need long names because there is no function overloading either and everything lives in the same (only) namespace, _and_ you have to rearrange your uses of your numeric class from the familiar infix style to a completely unreadable functional style (i.e. "bignum_mult (bignum_add (a, b), c);" instead of "(a + b) * c);").

      How about those templates? The only alternative you have in C is #defines. Don't tell me that nightmare is somehow going to be more readable than its C++ equivalent for anything non-trivial. And your code generation absolutely explodes because those #defines get expanded everywhere.

      Rule of 3/5? C should be happy to have that luxury. Instead you get "my_struct_type_copy (a, b);" if your struct happens to be non-trivial. And don't ever forget one, because the compiler is perfectly happy just giving you a shallow copy.

      As for IO streams, the C++ community is in full agreement that it was not designed very well (hey, early days of the language...). There are plenty of alternatives now, and one of those is likely to be standardized sooner or later.

    13. Re:Hasn't Ada fixed all of this decades ago? by mandolin · · Score: 1

      I don't currently use Rust or Ada, but I think Rust has enough original useful ideas and tradeoffs -- along with a corresponding need for a lack of baggage a la the "C -> C++" compatibility story -- that it was worth pursuing as a separate language.

    14. Re:Hasn't Ada fixed all of this decades ago? by Anonymous Coward · · Score: 0

      Hmm, on the note of standard libraries it seems the AdaDoom3 project on Github features many bindings like openal, opus, vulkan, zdelta, zlib, as well as a custom win32 media layer. I would love to see it all in action even if it is only capable of basic rendering!

      BTW, Ada has definable number types that don't require overloaded operators for interchangeability between other numbers and additionally you can overload anyway them if you wanted to.

    15. Re:Hasn't Ada fixed all of this decades ago? by Anonymous Coward · · Score: 0

      You're absolutely correct -- reviving and improving Ada would have been a better use of humanity's resources than creating Rust.

      Ever heard of Parasail? It's an Ada derived language that greatly simplifies issues by eliminating things like exceptions and the global heap, replacing them with compile time contracts and optional types. Basically seeking to build a safe language by construction. It's completely type safe, memory safe, and free of race conditions. And it was created a year before Rust.

    16. Re:Hasn't Ada fixed all of this decades ago? by mandolin · · Score: 1

      My apologies for somehow blanking about Ada and operator overloading! I don't like saying wrong things.
      Looks like Ada does support it, even in Ada'83.

  17. Perhaps such explicit separation is better. by Anonymous Coward · · Score: 3, Insightful

    Usually, when you try to merge the 2 ideas, you end up with something as stupidly inefficient as run-time introspection.

    So, because the guiding principle of C++ is "zero-overhead abstraction", perhaps it is the case that you must explicitly choose where the computation will occur—run-time or compile-time.

    1. Re:Perhaps such explicit separation is better. by K.+S.+Kyosuke · · Score: 1

      So it's actually "zero-overhead abstraction(*) ((*)brain overhead excluded)"?

      --
      Ezekiel 23:20
  18. If you don't know where to start... by Anonymous Coward · · Score: 2, Interesting

    ... then how are you not clueless?

      Right now ESR is way ahead of you by having some actual thoughts to share, no matter how wrong they may turn out to be. You're nowhere near that. So you go on, pick any thing, start there.
      Here, let me help you: Me, I think that ideology makes for poor abstracting in programs, so rust is out. Incidentally that "community" is full of people who are so full of it they "can't even". (Which is one reason why ESR would be wrong picking rust as a successor to C: rust people "can't even", C people very much just do.) Now you pick anything else, maybe the next thing you can think of right off the bat, and enlighten us with your insights.

    1. Re: If you don't know where to start... by Anonymous Coward · · Score: 0

      Don't you ever tell my son what he can do with my iPad ever again.

    2. Re:If you don't know where to start... by imrahilj · · Score: 1

      Wait, do you mean Go? ESR picks Go as the successor to C, not Rust. He imagines that garbage collecting will someday be more efficient, efficient enough to make Go competitive for systems programming and that Go is simply a better language than Rust.

  19. ESR is incompetent by loufoque · · Score: 3, Interesting

    I remember I interacted with him back when he started the irker project.

    That pretty trivial piece of software, written in Python, was riddled with bugs, and no amount of bug reporting and discussing with him the design mistakes got anything fixed for a whole week, despite him actively trying.
    I rewrote the whole thing in C++ in two days and it always worked robustly from the get go.

    1. Re:ESR is incompetent by Anonymous Coward · · Score: 0

      Well, what did you expect from a program named 'irker' ?

    2. Re:ESR is incompetent by Anonymous Coward · · Score: 0

      but afterword you cuddled and talked about guns right?

    3. Re:ESR is incompetent by null+etc. · · Score: 0

      He must have been too busy complaining about SJW, political correctness, and how Obama was going to take all our guns and make women equal to men.

    4. Re: ESR is incompetent by Reverend+Green · · Score: 2

      Link to your version, broham?

    5. Re: ESR is incompetent by loufoque · · Score: 2

      google rekri.
      haven't used it in a while though.

    6. Re:ESR is incompetent by Anonymous Coward · · Score: 0

      > I rewrote the whole thing in C++ in two days and it always worked robustly from the get go.

      Why not just fix the bugs? Afraid of Python? A high level language such as Python is a better choice in this case.

      Btw, where is your c++ code. I search for irker and I find esr's python code.

  20. Re:Provided you have infinite hardware resources.. by Opportunist · · Score: 3, Insightful

    Personally, I think way more problems arise of terse syntax and high symbolic abstraction that C/C++ and derived languages like so much. I mean, I'm as lazy as the next programmer and that's why I like C (and its derived languages) but even I cannot ignore that
    { (a!=1)?b=!b:b=0}

    is way less readable than

    begin
    if a is not equal 1 then set b equal complement of b else set b equal 0
    end

    You'd immediately spot an error in the second because the sentence would look "wrong".

    --
    We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
  21. Ok, you want a garbage collector by GuB-42 · · Score: 1

    Ok, you stated your position in the old debate. It is clear that you want a garbage collected language. Some high profile programmers agree with you, others have different ideas.

    Personally, I tend to prefer manual memory management, I think that garbage collectors are wasteful and that abstraction pile is the reason why we have these ridiculous 6 GB smartphones that still have unacceptable latency. But I understand the value of it.

    1. Re:Ok, you want a garbage collector by K.+S.+Kyosuke · · Score: 3, Funny

      If GC is the reason for 6 GB smartphones, why does booting your non-GC'd Windows desktop take more memory than booting a GC'd Lisp Machine OS?

      --
      Ezekiel 23:20
    2. Re:Ok, you want a garbage collector by Anonymous Coward · · Score: 0

      I think that GC are normally too limited, that it would be neccesary to have some (create this instante in a memory pool) to free some memory at the same time and change every "pointer" to a previous existing instance to Null.

      Some manual allocation is good for avoid fragmentation too. When you know that a lot of memory are "samesize" (always the same time allocated) allocate in the same place that other instances are a bad idea. Specially in todays 64 bit computers where our space address is enough huge to create multiple heaps without problems.

      Yeah. Some GC could create this automatically, but I doubt that they did correctly everytime.

      Personally I prefer a language that have the funcionality, although specially called (like "unsafe" in c# for pointer use) than not have it.

    3. Re:Ok, you want a garbage collector by GuB-42 · · Score: 1

      Because, a Windows desktop today does much more than a Lisp machine.
      The GC is not the only culprit, it is a multiplier. Your GC can make your program go from 1kB to 2kB, or from 1GB to 2GB. Of course, we can ask the question : "why is it 1GB in the first place?" and it definitely is a very good question, but the GC certainly doesn't help.
      Now, maybe the extra work involved in using manual memory management would be better spent optimizing GC usage and lowering the base requirement. This could make the program go from 1GB (2GB with a 100% GC overhead) to 500MB (750MB with a 50% GC overhead) and beat the original. It's an interesting debate.

      The usual stance however seem to not give a shit and throw hardware at the problem. It is a valid stance : faster time to market, better focus on user requirements than technical details, cheaper, etc... It's just that I am a bit sad to see so much power wasted on abstraction layers, GC being just part of it, especially on mobile.

    4. Re:Ok, you want a garbage collector by Anonymous Coward · · Score: 0

      If GC is the reason for 6 GB smartphones, why does booting your non-GC'd Windows desktop take more memory than booting a GC'd Lisp Machine OS?

      Don't your GC'd Lisp Machine OS actually do anything when you boot it up?

  22. And we care about his opinion because ? by Anonymous Coward · · Score: 0

    If you don't know how to use C++, just don't. If you want to use Python or Go or Perl, suit yourself.
    Using 100% of C++'s features is pretty easy (and in a team there are coding standards, when you don't work with monkeys)
    If you want elegance and power, C++ is pretty nice (but granted, most of its features are not for newbies and amateurs).
    If you want easy you use Basic, Python and the likes.
    I've written millions of line of codes in the past 36 years. Mostly x86 assembly followed by C++, C, C#, Ada, Java, Pascal, ... (in decreasing amount).
    By far my favourites are C++ and C# (and assembly because you don't get surprises like when the compiler goes wrong ).
    In my point of view, Java sucks and does not compares to C# in term of design and internationalisation.
    Of course nobody should care about my opinion anymore than his (nor the Queen of England's)

    Opinions and authority argument are fallacies.

    1. Re:And we care about his opinion because ? by K.+S.+Kyosuke · · Score: 1

      Using 100% of C++'s features is pretty easy

      I hope that means "in a large project, that happens very easily" rather than "it's grokkable". Otherwise you should perhaps dedicate your brain to science for the purpose of furthering mankind's fate by means of transhumanism.

      --
      Ezekiel 23:20
    2. Re:And we care about his opinion because ? by jcr · · Score: 1

      If you want elegance and power, C++ is pretty nice

      Dude, put down the crack pipe.

      -jcr

      --
      The only title of honor that a tyrant can grant is "Enemy of the State."
    3. Re:And we care about his opinion because ? by Anonymous Coward · · Score: 0

      How many millions?

      36 years is about 8640 weeks. Given a 5 day working week and 48 weeks per year.

      Dividing a million lines by that (1000000 / 8640) is 116 lines of code per day.

      A good developer produces about 10 lines of code per day. No matter what language is used. That includes design, testing, debugging and documentation work.

      https://betterembsw.blogspot.fi/2010/05/only-10-lines-of-code-per-day-really.html

      That makes you a super star productive and tenacious programmer.

      Or a bullshitter.

       

  23. what a bull by mapkinase · · Score: 1

    Zillions large scale C++ projects, and nobody creates or deletes bare pointers,veerybody uses smart pointers

    --
    I do not believe in karma. "Funny"=-6. Do good and forbid evil. Yours, Oft-Offtopic Flamebaiting Troll.
    1. Re:what a bull by roca · · Score: 1

      People use bare pointers all the time: "this". They also use references, which are semantically equivalent.

      "Modern C++" with smart pointers etc doesn't come close to protecting you from use-after-free bugs. See for example https://github.com/isocpp/CppC...

    2. Re:what a bull by zifn4b · · Score: 1

      Zillions large scale C++ projects, and nobody creates or deletes bare pointers,veerybody uses smart pointers

      Real C++ programmers understand the nature of compile time languages and almost exclusively use RAII. C++11 makes it even easier to follow this principle.

      --
      We'll make great pets
    3. Re:what a bull by zifn4b · · Score: 1

      People use bare pointers all the time: "this". They also use references, which are semantically equivalent.

      What the GP meant to say was "pointers dynamically allocated with the new keyword" not "bare pointer". Discussing use of the -> operator is not productive because all smart pointer constructs usually have this operator overloaded for example std::auto_ptr. this, as I'm sure you know, is a special "bare pointer". If I had a class Foo and in some scope I declared: Foo foo; for example, inside of foo I might access foo's members by calling this->someMemberVariable (usually inherited). Even though I'm using the this keyword, I'm using it in the context of an object that has been allocated on the stack. It's equivalent to doing (&foo)->bar(); outside of the object context

      There are several reasons why languages like C++ are being abandoned in favor of other lower performing languages that cause more bloat. 1) It's hard to program well in C++ and 2) More libraries are available in other languages so you don't have to re-invent the wheel

      --
      We'll make great pets
    4. Re:what a bull by PoopJuggler · · Score: 1

      I use bare pointers when I want to control destruction. I also use smarter pointers when I don't care. You silly kids and your absolutes...

    5. Re:what a bull by Tranzistors · · Score: 1

      People use bare pointers all the time: "this".

      Parent specifically said that people don't use bare pointers for creating and deleting objects. Of course, people still do it, but shouldn't.

    6. Re:what a bull by Anonymous Coward · · Score: 0

      And then you actually review the code that people like yourself are so proud of, and you quickly realize that your assertions are based on nothing, and that everybody *is* doing these things. We simply don't live in a world where people have the time to do things properly, or even to fix them after the fact. That's why we need to remove the ability to create classic "bad" code and stay away from known footguns. Languages like C++ do not do this, because they're not driven by an ethos centered around code quality, but rather quantity. We need languages to try to bridge that gap, and stop encouraging us to write bad code when we're not given the time to write good code. It has become clear that it doesn't matter how many static analyzers we throw at the problem, simply being able to write bad code is enough to perpetuate this problem.

    7. Re:what a bull by david_thornley · · Score: 1

      They also use references, which are semantically equivalent.

      Yeah, and Java and C# have tons of pointers. If it isn't a native type in Java, it's a pointer type with enough syntax to make it not immediately obvious. Also, a for loop is semantically equivalent to some tests and gotos, so we can't program without gotos, right?

      You can't do everything with references that you could do with a raw pointer. Semantically, a reference is the same as the object itself. Similarly, "this" is an rvalue, and therefore can't be changed. These are not the same as raw pointers.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    8. Re:what a bull by angel'o'sphere · · Score: 1

      Smart pointers, just like ordinary pointers, still require you to new/create the objects.
      Or do they spring out of nothing?

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    9. Re:what a bull by Anonymous Coward · · Score: 0

      I literally never write memory errors in C++. No use after free, no double delete and no memory leaks. It is extremely easy to avoid such errors by using RAII abstraction. Smart pointers aren't even necessary for it and I don't tend to use them. Reference counting adds overhead you don't need. Even for maintaining graphs while modifying them you don't need reference counting. Every once in a while it is convenient to use reference counting for an algorithm to avoid having to think about the complexity of resource ownership. I view it as a very niche approach that only seems like the answer to memory management problems to people who don't actually understand how to use C++ as intended. The power of C++ for writing high performance code is in the ability to construct custom memory pools. To do that you need two things: bare pointers and bare metal control over memory including the ability to override strict type safety and a programming model that allows you to manage your own pooled memory that is convenient and consistent with the way normal memory is managed so you have access to the full language. I write memory pools and override new/delete and valgrind can't check user defined allocations for correctness, yet I never need to use the compiler flag to disable my memory pools to run memory checking tools because, as I said, I never have memory errors. It's a solved problem and it is just weird that people still freak out about it. If after a few years of experience a developer is still writing memory errors in C++ they should be shown the door and find a language with training wheels on it.

    10. Re:what a bull by roca · · Score: 1

      "Hard to program in C++" can be written in another way: "C++ is error-prone". And that's a problem with the language.

    11. Re:what a bull by Anonymous Coward · · Score: 0

      You spelled "my code is not exception safe" incorrectly.

  24. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    The problem with C++ is that it is a relatively ugly language with fragile infrastructure, that is getting more and more complex and uglier with every new release, because new features are actually not removing the language deficiencies but are workarounds (sometimes very ugly ones) around existing language deficiencies which are just left there so to not break the backward compatibility. As backward compatibility has its benefits, so does ever-increasing complexity its caveats.

    It has huge issues, that because of backward compatibility, either cannot be solved at all (Pimpl anybody? memory safety?) or cannot be solved in an simple and aesthetically pleasing way. In my personal opinion, the average code written in C++ (especially C11 and greater) is just damn ugly and is getting more and more harder to understand on the "first look".

    In my view the language infrastructure is very lacking by moderns standards and need huge modernization. Also there is a lot of boilerplate code compared to some other languages, like implementation of patterns that are in some other languages part of the language, and because of other stuff like Pimpl, headers, etc. I would move some very common patters as much as possible into the language, maybe not into the runtime, but to make a syntax that will reduce this boiler plate code, this is a synthetic sugar I would like to see in the language.

    Of course, solving all this mentioned problems is no possible without breaking backward compatibility. I am not saying that backward compatibility is bad, just stating what are limitations and what we are losing with this choice. The choice has its obvious benefits, but it is also making language less and less desirable to use, and as this continues, I believe that replacement candidates will start popping up more and more.

  25. Re:Provided you have infinite hardware resources.. by TheRaven64 · · Score: 4, Insightful

    It's not always so clear cut. What you say is definitely true for naive compilers, but higher-level abstraction also often mean more information for the compiler and more freedom for the compiler. These can translate to better optimisations. To give a trivial example, languages like Java provide an abstraction that looks like a C struct, but don't require that the memory layout be visible to the programmer. Imagine that you create a struct-like Java object with RGB values to represent a colour and you do the same in C. Now you put them in an array and try to do some processing on them. The C version is constrained to lay out the objects as three fields with no padding (this is visible in the language with sizeof and will break ABIs if it dynamically changes). The Java version, in contrast, is allowed to put an unused padding field at the end of the struct. Why does that matter? If you want to vectorise the loop, then being able to guarantee 4-element alignment for every object in the array is a huge win. This is a legal transform for a Java compiler, but not a legal transform for a C compiler unless it can prove that no pointers to the array escape (and a few other constraints).

    The big advantage of C was that a fairly simple compiler for a simple architecture could get very good performance. The disadvantage for C is that compilers quickly hit diminishing returns and the abstract machine makes a number of desirable optimisations unsound.

    For example, if your language has a first-class notion of immutability, then this gives the compiler the opportunity to elide copies or add copies if they make sense for NUMA systems, and gives the compiler a lot more freedom with regard to reordering or eliding loads. Similarly, if your source language has higher-level notions of sharing then this means that you can avoid a lot of defensive memory barriers that you'd need for correct C/C++ code. If your language has stricter guarantees on aliasing, then a whole lot of optimisations suddenly become easier.

    Any compiler optimisation is a mixture of two things: an analysis and a transformation. The analysis must be able to tell you if the preconditions for the transform are met. The more information you can give to the compiler, the more often the analysis can prove that the preconditions hold and enable the transform.

    --
    I am TheRaven on Soylent News
  26. Re:20% slower!???? Are you INSANE!!!!!!111???1111! by gnupun · · Score: 1

    I'd like that stolen battery life back please, you Code Monkey.

    And the programmers who write your phone apps would like it very much not to waste 10x or 20x of time writing software in a half-low level and half-high level language like C++. That's why they use Java (Android) or Swift (iOS). Before Swift, programmers had to use Objective C, which is slow as hell in terms of app development time.

  27. Who is ESR? by Anonymous Coward · · Score: 0

    I can tell he has no real relevance in todayâ(TM)s programming world. Java is a disease, and nothing will dethrone C/C++

  28. Construction metaphore by DrYak · · Score: 4, Interesting

    And good frameworks help with that. When I build a house, I don't want a craftsman who takes time to learn how to use an adze so he can plane down lumber to the correct size for the job; I want a builder who knows he can get lumber of the correct dimensions right at the store.

    On the other hand, when all you want to build is a garden shed, you can do it yourself in a quick week-end afternoon project by quickly nailing a few planks together. You definitely don't want a several month-long adventure involving half a dozen sub-contractors (and each further down, their own individual group of a dozen of sub-contractors), plus hiring a few special planification manager (because sub-contracors D and Y each out-source their screw to a different sub-sub-contractor. Incompatiubles) which will all require two hectars of work space around your shed. And somehow the garden shed need to be connected to an industrial triphase 380V power connector in order to be able to function.

    Some time, over reliance on frameworks and helpers means that some very simple projects that would be handled by a few dozens of C or C++ lines of code (perhaps a couple of hundreds top), suddenly need to pull more than 20 MiBs of libraries in the package and are dependent on 200 different github repositories (hoping that they'll not blocked on the dev's whim - see Node.js and string alignement). And you need to use special command line settings to tell the VM to allocate 2 GiB of memory for the process.

    --
    "Sufficiently advanced satire is indistinguishable from reality." - [Tips: 1DrYakQDKCQ6y52z6QbnkxHXAocMZJE61o ]
    1. Re:Construction metaphore by JaredOfEuropa · · Score: 2

      Quite. Which is why the inclusion of a framework should be a matter of design not coding. This decision should be left to a software architect rather than a developer.

      --
      If construction was anything like programming, an incorrectly fitted lock would bring down the entire building...
    2. Re:Construction metaphore by HornWumpus · · Score: 1

      Define 'software architect'. Seriously, danger will robinson.

      That title has been abused to hell and back in the last 10+ years. Some places it means 'very senior dev', some places 'project tech lead', but in some other places it means 'business knowledge specialist' or 'systems analyst'.

      Frameworks, if used at all, ARE fundamental decisions. Beware choosing 'new hotness'. Always consider escape plans. Needs to be made at the highest technical level, after some limited discussion (generally limited to first hand experience, theoreticians shown door).

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    3. Re:Construction metaphore by iampiti · · Score: 1

      Yup, and that's why we now have mobile apps which weigh in the hundreds of MB and are dog slow. All that on devices that run on a battery. Stupid, stupid, stupid.
      I know it's all about ease and time of development but the waste of space and CPU time is gigantic

    4. Re:Construction metaphore by Anonymous Coward · · Score: 0

      According to most of the books I've read, they all agree that the architect's role is to define pretty much everything, from the servers, to the network, to the storage, to the OS, to the file system, and how everything relates. The code written by the devs should mirror the vision the architect has, almost nothing is left to the whim of the implementer. This is not a pie-in-the-sky ideal. It is practical and the best (under time and under budget) projects do it this way.

      Few people have the intuition to understand everything to such a detail to be able to do this. Experience has nothing to do with their ability to architect. I've seen several of the lead architects from places like Microsoft, Google, and Facebook say they would rather have someone who has never programmed in their life but has a "knack" for it, than someone who only has experience. They say this because they've seen it happen. Some people are just really good at understanding everything [about programming] without knowledge or experience. Programming is about logic and reasoning. That's all you need. Anyone can practice logic and reasoning by purely thinking. Some people turn this into a way of living that they've been exercising since before they can remember.

    5. Re:Construction metaphore by HornWumpus · · Score: 1

      Damn, perfect example.

      That's the biggest pile of bullshit I've ever seen. Have fun with your fresh, green 'Architect'. I see 12th normal form in your future, that and Javascript on the server.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    6. Re:Construction metaphore by Anonymous Coward · · Score: 0

      You've obviously never worked with someone who is gifted at reasoning. I've seen a fresh out of college programmer who had at most a few weeks of experience, virtually zero knowledge, crack a problem in minutes that had a room of 10 or so architects and senior devs stumped for days, using nothing but a bunch of intuitive assumptions. This person literally had to go to wiki to look up how some of the things the seniors were talking about worked, like HTTP and HTTPS.

      Every time someone gets stuck on a problem for days or even weeks, this person comes along and solves the problem in seconds or minutes, even though they almost never have any experience or understanding of the domain. They have a "knack" for problem solving.

    7. Re:Construction metaphore by Anonymous Coward · · Score: 0

      Caffeine still kicking in. I forgot to mention that this person has written several large key libraries that we use in day to day work. One of these libraries were in development with another group, but that group had spent a few months on it already and expected a few more months. Our department could not wait that long. This programmer stepped up and wrote the entire library from scratch in a few days just during normal work hours. It was literally bug free. It was intuitive to use and had useful error messages to make debugging a breeze.

      The other team eventually finished up after nearly 6 months. We looked at their library only because they spent 6 months on it and they were the official group to write it. It was buggy crap, ran slow, failed for so many unknown reasons, and only had the MVP. The library this programmer wrote had all kinds of new personal ideas that they had while working on the project. This was but one example. This person literally does these kinds of things every day, but only for difficult problems. They have concentration issues on easy or repetitive problems. Pretty much everything they have ever touched has been nearly flawless.

      Unfortunately they have poor communication skills, which makes it difficult for them to be an actual lead architect, but would make an excellent co-architect. My main point being there are people who can create nearly perfect software on the first attempt.

    8. Re:Construction metaphore by Anonymous Coward · · Score: 0

      Hi, that is very interesting and I have met a few of these prodigies myself. In my experience, they are great when working in a problem domain familiar to them, but give them a complex problem outside their area of expertise, and one if two things happens:

      1. They buckle down and learn everything they can in depth, which takes time even for a whiz kid, and they are not much more productive than a programmer with experience in that domain, or

      2. They make lots of assumptions and overestimate their understanding, in which case you get a poor solution quickly. Often they don't even realize how little they understand until it's too late.

      If you haven't read Tracy Kidder's Soul of a New Machine, I highly recommend it. Tom West exemplifies approach #1.

  29. Wrong direction by Anonymous Coward · · Score: 0

    With so many languages, try searching a code snipped for "c", "go". Why can't they give a unique name to them??

    1. Re: Wrong direction by Zero__Kelvin · · Score: 1

      C was created well before the www, so that might explain it. Try adding "language" to the search, e.g "go language".

      --
      Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
    2. Re:Wrong direction by Anonymous Coward · · Score: 0

      With so many languages, try searching a code snipped for "c", "go". Why can't they give a unique name to them??

      They really should just change the name of Go to Golang.

    3. Re:Wrong direction by Pseudonym · · Score: 1

      I like it. In Javanese (i.e. the actual Java language), it means "unsteady".

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
  30. Re:Provided you have infinite hardware resources.. by Dutch+Gun · · Score: 4, Insightful

    The higher the level of abstraction in your language, the higher the overhead it will create.

    This is exactly why C++ remains popular among those who create large, complex, high-performance applications. C++ is well known for using zero-cost abstractions. That means you get the performance of low-level C code, but can design much safer interfaces and type safety in your code which allow the compiler, not a runtime, to validate that the code is correct and safe.

    For certain types of applications, it's an effective compromise between the pragmatism of retaining backwards compatibility with decades-old ecosystems, while at the same time providing better safety and abstractions than C.

    --
    Irony: Agile development has too much intertia to be abandoned now.
  31. Extended Support Release by jfdavis668 · · Score: 1

    My first thought was they were referring to some system's Extended Support Release.

    1. Re:Extended Support Release by Anonymous Coward · · Score: 0

      Nothing to see here, he's just proclaiming that C and C++ are being EOL'd for the umpteenth time again. Pay no mind to the ESR......

    2. Re:Extended Support Release by hazardPPP · · Score: 1

      My first thought was they were referring to some system's Extended Support Release.

      Mine that they were talking about equivalent series resistance.

  32. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    Did you get ! mixed up with ~; or is b a boolean and 0 should be false.

    Either way, your 'English' equivalent was wrong and it doesn't look wrong.

  33. I left C and C++ for a reason by LostMyBeaver · · Score: 0

    Simple... I needed something better.

    C and C++ are both amazing languages but :
        a) C and C++ are not and never have been worth a damn as a standard. Even in the absolutely best C and C++ code, there are so many platform abstractions and #ifdefs that it's a nightmare. Neither C or C++ are useful as a platform.
        b) C and C++ are not so fast anymore. There was a time where you couldn't write better code in assembler than a well optimized C or C++ code set could produce. Working in tools like Intel vTune Amplifier and optimizing your C or C++ code allowed amazing code performance to be achieved. Then money was spent on JIT technologies and hand optimized JIT code ended up being substantially faster in most cases.
        c) C and C++ are more versatile than any other languages because you can program at a register level if you choose to. Need to make a new kernel system call interface... C or C++ are your languages. If you want to hand code vTables for object inheritance, C is for you.
        d) Everything useful in C/C++ requires non-standard language extensions. Need proof? Look at the Linux kernel and try compiling it with a strict standards compliant C compiler.Try the same with the different standard C library implementations.

    I can go on, but in reality, C and C++ are not very good anymore for anything other than operating system and JIT development.The code they generate is often far less than optimal. They target individual CPU revisions. They have no internal knowledge of the cache management structure of the system they're running on. They can't optimize code on the fly for "inlining" code differently based on how it is used and the current state of the processor pipeline architecture. Multithreaded and multiprocessing code has to make excessive use of locks (semaphores, mutexes, etc...) to manage shared memory and cache coherency because pipeline directions aren't easily detected and IPC can't be achieved exploiting ring-bus direction to its advantage since the compiler has no idea whether it's running on a ring or a mesh or even how many cache levels it has available.

    This is what make things like CUDA far more interesting for high performance computing. If for no other reason than the CUDA compiler runs as AOT for the local platform. C and C++ is limited to whatever the developer compiled for.

    Let's talk memory management. Garbage collected memory in a dynamic memory system is ALWAYS faster than manually managed memory. Using even the best memory allocators in C and C++ generally causes fragmentation hell. Let's also consider that free always frees now. They depend on pool systems which are often quick but make an absolute mess of the system. Memory is in fixed positions which can't be defragmented.

    I can go on and on... but in 2017, no hand coded memory model will ever compare to a good garbage collected memory manager.

    While I'm not a huge fan of JavaScript, I love Node.JS performance. Node.js is absolutely insanely high performance because of roughly a billion dollars invested by 4 companies in competition with each other to make the fastest JavaScript JITs. Right now, for code performance and memory optimization techniques, there probably isn't anything out there that can touch JavaScript for performance. Let's not forget the inherent async programming model of modern JavaScript which makes it absolutely beautiful for multithreading or even more importantly, scaling through microservices.

    Again, I can go on and on... but these days you can use things like EnScripten if you really must have C and C++. There's also things like TypeScript and other languages which transpile to JavaScript. There's also some high end compilers like C#/HTML5.

    These days, there's absolutely no good reason to be using C/C++ unless you're a sadomasochist who actually thinks they can write better code by hand than can be produced by modern JavaScript JITs

    1. Re:I left C and C++ for a reason by Anonymous Coward · · Score: 1

      Do you have any evidence to back up these claims of performance? A quick Google seems to disagree:
      https://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=node&lang2=gpp

    2. Re:I left C and C++ for a reason by zifn4b · · Score: 2

      a) C and C++ are not and never have been worth a damn as a standard. Even in the absolutely best C and C++ code, there are so many platform abstractions and #ifdefs that it's a nightmare. Neither C or C++ are useful as a platform.

      This is probably the most useful of your points which can be summarized as it's very hard to write something in C or C++ that is cross-platform even a standard. Doing so requires use of macros that can get quite complex at times (#ifdef __LINUX ). It also gets more complicated with Makefiles and makedepend. There are two problems:

      1) The libraries available on the specific platform
      2) C and C++ are compile time languages meaning that a C/C++ compiler compiles down into the native processor's instruction set whereas languages such as C# or Java compile down into platform agnostic byte code and then when run on another machine are dynamically compiled into that machine's native instruction set using the JVM (java) or the CLR (C#). Everything is a trade-off.

      --
      We'll make great pets
    3. Re:I left C and C++ for a reason by Anonymous Coward · · Score: 0

      > These days, there's absolutely no good reason to be using C/C++ unless you're a sadomasochist who actually thinks they can write better code by hand than can be produced by modern JavaScript JITs

      Yeah, let me know when you've written a kernel in javascript, or some other JIT language.
      C is not useful anywhere other than OS level programming? So what, that's still the most important part of programming.
      Without the kernel all that other shit doesn't matter one bit.

    4. Re: I left C and C++ for a reason by Zero__Kelvin · · Score: 1, Troll

      Holy shit. That was some of the longest rambling incoherent bullshit founded in incompetence and ignorance I have read in quite some time.

      --
      Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
    5. Re:I left C and C++ for a reason by david_thornley · · Score: 1

      So, by (1) are you complaining that the C++ standard library is too small? Anywhere you go, you will find libraries that work better with one platform or another.

      In (2), you are describing implementations, not standards. If there is a reason to compile C or C++ to some sort of byte code, it could be done. C and C++ are normally cross-platform in the sense of recompiling for each platform, which isn't typically a big problem.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    6. Re:I left C and C++ for a reason by angel'o'sphere · · Score: 2

      c) C and C++ are more versatile than any other languages because you can program at a register level if you choose to.
      Just try it, then look at the assembly code ... "register" most likely got ignored.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    7. Re:I left C and C++ for a reason by Anonymous Coward · · Score: 0

      Not if you write inline assembly ;)

    8. Re:I left C and C++ for a reason by Pseudonym · · Score: 1

      Just try it, then look at the assembly code ... "register" most likely got ignored.

      Deprecating "register" is one design decision that I am a little ambivalent about. What it should mean is "it is an error to take the address of this variable", no more and no less.

      It's a niche feature, but one that's occasionally useful.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    9. Re:I left C and C++ for a reason by Pseudonym · · Score: 1

      Neither C or C++ are useful as a platform.

      Surely that's the point? The places where you tend to see C and C++ used the most are precisely those situations where an abstracted software environment is not the platform, the hardware and the OS are the platform.

      b) C and C++ are not so fast anymore. There was a time where you couldn't write better code in assembler than a well optimized C or C++ code set could produce. Working in tools like Intel vTune Amplifier and optimizing your C or C++ code allowed amazing code performance to be achieved. Then money was spent on JIT technologies and hand optimized JIT code ended up being substantially faster in most cases.

      I respectfully disagree about "most cases".

      The cases where managed JIT-compiled languages tend to do win big compared to C++ are those cases where abstractions can be compiled away at run-time because they are not used. The classic case is engineering for testability; Java programmers often make an interface for every "important" class so that it can be replaced with a mock or stub during test time. Hotspot can compile these interfaces away at run-time because the mocks and stubs are never used at run-time.

      It's worth pointing out that this only applies to languages like Java or C#. These optimisations are typically not available to Node.JS.

      You get a small win from tuning the compiled code to the platform on which the system is actually running, but in my experience you lose it back in virtual machine overhead (e.g. memory footprint).

      Managed JIT-compiled languages tend to do worse on the most common and most important data structure in existence: the array of structs. This is why any program which is algorithmically nontrivial is almost always slower in a managed JIT-compiled language than in C++.

      Having said that, there's a lot of algorithmically trivial code out there. The modern world basically runs on scripting/glue layers.

      But for me, the biggest issue is this: A critical mass of software these days run on machines that are powered by batteries, and it's only going to get worse. CPU cycles are no longer the most important factor to optimise for. Battery life is far more important. In this environment, compiling at run-time is the worst of all possible worlds.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    10. Re:I left C and C++ for a reason by Anonymous Coward · · Score: 0

      > This is probably the most useful of your points which can be summarized as it's very hard to write something in C or C++ that is cross-platform even a standard. Doing so requires use of macros that can get quite complex at times (#ifdef __LINUX ). It also gets more complicated with Makefiles and makedepend. There are two problems:

      Correction; It's relatively to write good C/C++ portable and cross-platforms as long as you exclude Windows of your platform list.

  34. Native is not VM by Anonymous Coward · · Score: 0

    Managed language will never replace native languages and vice versa. Eventually Rust or Go will replace Java thanks to Oracle crappy leadership..

  35. Root Mean Square? by Anonymous Coward · · Score: 1

    That's the only RMS that I know.

  36. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    .Net is the Transformers of programming languages

  37. Re:Provided you have infinite hardware resources.. by Opportunist · · Score: 2

    If you want to say that it explodes violently in your face from time to time, it has an attitude that few can stomach, is way overengineered for its supposed purposed and manages to go around in circles of trying to fight itself and stand in its own way instead of getting to the point and be done with it, yes.

    --
    We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
  38. Is she related... by Anonymous Coward · · Score: 0

    ...to ELO?

  39. Re:Provided you have infinite hardware resources.. by religionofpeas · · Score: 4, Insightful

    With some extra spaces, and the whole thing changed to an expression (which is how ?: is supposed to be used) it's a lot easier to read.

    b = (a != 1) ? !b : 0

    The advantage of the ternary operator is that you only need the LHS part once, which helps if it's a more complex variable.

  40. Why not put GC by Anonymous Coward · · Score: 0

    In the hardware? We already do a lot of MM in the hardware.

  41. Love the defence of C++ by Anonymous Coward · · Score: 0

    Goes to show a lot of American coders out there whining about losing their jobs.

    1. Re: Love the defence of C++ by Anonymous Coward · · Score: 0

      Maybe open source was a mistake. Our generosity has been repaid with impoverishment. Laugh while you can - eat, drink, & be merry - your time will come too.

  42. Re: Provided you have infinite hardware resources. by Zero__Kelvin · · Score: 1

    As you have shown the error stems from the programmer, not the language. If you can't easily look at that C code and see that it won't compile then that explains why you find the language difficult. You don't even have beginner level proficiency.

    --
    Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
  43. Re: Provided you have infinite hardware resources. by Zero__Kelvin · · Score: 3, Informative

    Pimpl is solvable by creating an implementation class and and interface class that has a reference to that class, and if you are crying about memory safety starting with C++ 11 there are smart pointers.

    --
    Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
  44. Wait what? by SCVonSteroids · · Score: 1

    Hates C++.
    Loves Java.
    Go will *replace* C?

    Is there anything of value to read here? (No I haven't even RTFS)

    --
    I tend to rant.
    1. Re:Wait what? by Pseudonym · · Score: 1

      Is there anything of value to read here?

      It's a post-9/11 ESR blog post that's not about Colossal Cave Adventure. So no.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
  45. Drivers/Firmware by zifn4b · · Score: 5, Insightful

    How do I write drivers and firmware in Go? I think C is going to be around for awhile.

    --
    We'll make great pets
    1. Re:Drivers/Firmware by Anonymous Coward · · Score: 0

      First you have to cut off your penis.
      Wait, that's with rust.

    2. Re:Drivers/Firmware by metamatic · · Score: 1

      He addressed that point. As you'd know if you'd read the fucking summary, let alone his article.

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    3. Re:Drivers/Firmware by zifn4b · · Score: 2

      He addressed that point. As you'd know if you'd read the fucking summary, let alone his article.

      No he didn't. This is bullshit:

      Eventually we will have garbage collection techniques with low enough latency overhead to be usable in kernels and low-level firmware, and those will ship in language implementations

      This claim was made at least 15 years ago when .NET arrived on the scene. It was bullshit then and it's bullshit now. He doesn't know anything. You can't interact with physical hardware in a language that compiles just-in-time. At least not while using CPU architecture agnostic code. There are ways to interop with physical hardware but if you're doing that you might as well write the code in C to remove the layers of marshaling abstraction that will impact performance. You know the huge performance gains that Vulkan and DX12 made recently? That was done removing superfluous API layers. This person is suggesting we ought not only introduce that but more further slowing down game frame rates. You need to interact with it on the machine level at some point. You need to know how to push a value in a register on the CPU across the system bus to a register on a circuit board. In order to do that, you need to know the architecture of both pieces of hardware. You need to know little endian vs. big-endian. There is no way to do this programming without being all the way down to the metal. Anyone making a claim to the contrary has never actually done any driver programming and I wouldn't recommend that they start.

      --
      We'll make great pets
    4. Re:Drivers/Firmware by angel'o'sphere · · Score: 1

      You write them in the exact same way you write them in C ... or C++.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    5. Re:Drivers/Firmware by redmasq · · Score: 1

      I doubt firmware would be possible any time soon with JIT compile languages. Considering CPU speeds and memory sizes, garbage collection should be possible in firmware (after some bootstrap); however, it would be quite the waste considering the target. I would say similar for kernel drivers. User-land drivers such as certain types of human interface devices/filters, printer drivers, scanner drivers, maybe (big maybe) virtual file system drivers, or similar which would delegate its communication with hardware through an abstraction layer would at least be worth considering on systems with sufficient resources to make it worth while. Although, at that point, I would sooner call those services.

    6. Re:Drivers/Firmware by redmasq · · Score: 1

      An extra after thought, the effect of a JIT compiled language may be possible at the kernel level by "faking it." While there would be limitations, upon driver installation, native image generation could be done. The kernel would need to have some sort of metadata service. Garbage collection might could be a compiler service as well, but I would opt for having the initial code compile do static analysis for reference count and just inject deallocations after the last reference. Any case that cannot be verified to remain in scope would fail the compile; the programmer would have to revert to manual allocation/deallocation possibly disguised as support libraries and use at their own risk. Additional keyword or syntactic sugar might could be used when the programmer need to delay deallocation for some reason such as performance. Use try/finally (or equivalents such as try-with-resources, using keyword) for setting allocation boundaries or accessing scarce resources. Use case would be for rapid development of drivers for cross-architecture but same kernel where the driver does not require much direct memory access or IO, but would benefit from not having a context switch.

  46. If it's a choice between pointers and parens by NotSoHeavyD3 · · Score: 1

    I know in my worthless opinion that if I have to choose between getting pointers right in C++ or LISP's handling of parens where literally having too many or too few causes your app to crash then damn it, I'm going with the pointers.

    --
    Did you know 80 to 90% of the moderators on slashdot wouldn't recognize a troll even if one dragged them under a bridge.
    1. Re:If it's a choice between pointers and parens by david_thornley · · Score: 1

      Lisp is very difficult to write without some sort of prettyprinter in the editor. I usually use emacs. Lisp programmers normally recognize structure by the indentation, not the parentheses. C++ does have the advantage here in that it is easy to write with any editor, unlike Lisp, but with the right editor it's just as easy to write Lisp.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
  47. Re:Provided you have infinite hardware resources.. by Opportunist · · Score: 0, Troll

    If your point was to make that part more readable, I think I want you on the other team in the next debate.

    --
    We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
  48. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    The good thing about Rust is that the overhead is in programmer and compiler time, not in run time or a runtime library overhead. Their binaries are slim and fast.

    The bad thing is that there is a lot (big lot) of overhead in programmers brain and a slow compiler.

  49. A Java Kernel? by Anonymous Coward · · Score: 0

    A kernel running java?

    I don't want to wait 3 days for my computer to boot, let alone 3 weeks before the hotspot detector makes it *close* to usable.

    If Java is so great, we would be running compilers written in java, running on a java machine in java, which runs on a library in java. More recursion would mean more speed!

    But we don't. We still code in C. Everything performance oriented is in C or Assembly. If you don't care about performance, use Java.

    1. Re:A Java Kernel? by redmasq · · Score: 1

      Java's speed is not the issue. Java can be translated to work as native byte code which will typically be fast enough. The real difficulty is the lack of direct memory and IO access. In the "spherical cow" case, if the hardware/firmware has all of the necessary interface code, then abstractions can just be translated by included standard libraries. This, of course, would have to rely on something like an UEFI extension that provides device services (which would be still written in a "lower-level" language). I will note that bootstrap, up until more recent, was not even done in C or C++, but in assembly and often relied on BIOS calls to get things initialized. Someone with more time on their hands than I can test this statement by writing a Java VM in Java. The other option would be providing something similar to C# "unsafe" keyword except also including direct I/O which could be applied to the encapsulating class.

  50. Re: 20% slower!???? Are you INSANE!!!!!!111???1111 by Zero__Kelvin · · Score: 1

    OK. We've seen you go on and on about how a language you don't use or understand is horrible because you saw someone say it on Youtube. Thanks for sharing.

    --
    Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
  51. Re:Provided you have infinite hardware resources.. by AmiMoJo · · Score: 1

    I find

    (a != 1) ? b=!b : b=0;

    much easier to read and quickly interpret than "if a is not equal 1 then set b equal complement of b else set b equal 0". The former has much clearer delineations between the test and the true/false actions, for example. It can also be automatically formatted for readability by a code beautifier.

    --
    const int one = 65536; (Silvermoon, Texture.cs)
    SJW, n: "Someone I don't like, and by the way I'm a fuckwit" - AC
  52. Go's garbage collection does not help. by Anonymous Coward · · Score: 0

    Oddly enough today I have been trying to track down a crashing bug in a rather large Go project created by some ex-googlers. Which became a stable release as few releases back.

    In the logs it produces I find:

    panic: double close

    and

    panic: to many xyzDone() calls.

    As is often said, garbage collection of memory is only part of the resource management problem.

    Meanwhile using C++ last week I uncovered memory leaks and race conditions in openssl using the clang analysers. I presume openssl is written in C.

    I'm afraid it's hopeless!

  53. Re:Provided you have infinite hardware resources.. by BESTouff · · Score: 1

    The higher the level of abstraction in your language, the higher the overhead it will create. Now, it needn't be so absolutely stupidly overengineered as .net is, but still the metric fits, the more safeguards and handrails your language comes with, the higher the overhead it incurs to have them.

    Nope. Rust is a so called zero-cost abstraction language. What this means is you can pile layers of niceness to have clear and understandable code, and the generated code will be as good as if it had been hand-coded, manually unrolled.

    Getting rid of C/C++ isn't just for the fun of it. Language designers have done some real progress since a few years. Nowadays you can have beautiful and efficient code.

  54. Re: Provided you have infinite hardware resources. by Anonymous Coward · · Score: 0

    How much extra hardware could Equifax have had running with the cost of their breach? 10x? More?

  55. If Java GC Worked by Anonymous Coward · · Score: 0

    If Java GC worked, it would package itself up, collect itself, and delete itself from my system.

  56. Please forego the click-bait headlines by Anonymous Coward · · Score: 0

    According to my browser's search bar, ESR never used the word *hate* in post you entitled "Why ESR Hates C++, ...".
    Please don't do that again.
    Thanks.

  57. Re:20% slower!???? Are you INSANE!!!!!!111???1111! by MightyYar · · Score: 2

    I'd like that stolen battery life back please

    OK, just pay more for the extra development time, or use a version with fewer features. Every decision has trade-offs.

    --
    W..w..W - Willy Waterloo washes Warren Wiggins who is washing Waldo Woo.
  58. Re:Provided you have infinite hardware resources.. by CptLoRes · · Score: 3, Interesting

    But what happens when everybody buys lumber at the store? There still must be somebody that make sure the lumber is the right size and quality for your project. This problem is exactly why we today need giga range cpu's and ram just to watch a web page. Nobody knows how to deal with the details any longer, and so they end up building a new house every time there is a new problem.

  59. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    What you say is definitely true for naive compilers, but higher-level abstraction also often mean more information for the compiler and more freedom for the compiler. These can translate to better optimizations.

    Did you actually just pull the "sufficiently smart compiler" argument for higher level languages? There's a good write up on it at http://wiki.c2.com/?SufficientlySmartCompiler (and in that, when you see the statements about SSCs have been created, read the comments below that explain how those benchmarks were debunked and java is in fact, still slower than C).

    Seriously, as the SSC has never been created, your argument is hypothetical. And until you can create it, the SSC is not a good argument to make. It's sort of in the realm of P = NP. Nobody knows if it's possible, so it's best not to make arguments based on it until its figured out.

  60. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    It is 5000% more readable than the original. Perhaps you can't read.

  61. Re:Provided you have infinite hardware resources.. by Ambassador+Kosh · · Score: 1

    The python version of this works really well.

    foo = 1 if condition else 0

    --
    Computer modeling for biotech drug manufacturing is HARD! :)
  62. Keywords by hcs_$reboot · · Score: 2

    A language that has keywords like `static_cast` or `thread_local` has reasons to be hated.

    --
    Slashdot, fix the reply notifications... You won't get away with it...
    1. Re:Keywords by MobyDisk · · Score: 1

      Can you list some of them?

    2. Re:Keywords by Anonymous Coward · · Score: 0

      so do users with names like '_$reboot'.

    3. Re:Keywords by hcs_$reboot · · Score: 1

      You're too young...

      --
      Slashdot, fix the reply notifications... You won't get away with it...
    4. Re:Keywords by Anonymous Coward · · Score: 0

      Yes. At least 75% of the time spent fixing code at my job is because it was written in C++ by someone who thought they were a brilliant software "architect".

  63. Re: Provided you have infinite hardware resources. by Anonymous Coward · · Score: 0

    Beginners and expert obfuscators write the terse C++ style.
    Good Go-programmers just use simple if...else-semantics, and use meaningful but shortest possible variable names.

  64. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    Energy is free.
    Therefore we need not concern ourselves with writing a efficient piece of Software ONCE to be used by BILLIONS of people burning clock cycles.

    Though memory consumption might fall under marginal costs at the start of a new hardware generation, swapping out memory will consume more energy in the long term or require trashing the computer and wasting energy on a new one earlier.

    There's a tradeoff involved.

    (DRM is also funny, consuming 3 times as much Energy than non-DRM'd BD's. I guess other applications suffer similar costs.

    Also nice to throw away your TV or other HW because the standard got changed. Or the smart TV's Apps break one by one.)

  65. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 1

    Parent said:
    "The C version is constrained to lay out the objects as three fields with no padding (this is visible in the language with sizeof and will break ABIs if it dynamically changes)"

    That is incorrect.

    I used to write C code, and in my work, the struct fields were padded by the compiler to start on 4 byte boundaries by default. (This was because there was a speed penalty on SPARC CPUs to access words that were *not* aligned this way.)

    The gcc compiler gave you options (compiler flags) for how to align the struct fields. You could specify padding or not. I don't see why this would not still be the case.

  66. Re:Provided you have infinite hardware resources.. by swillden · · Score: 1

    If your point was to make that part more readable, I think I want you on the other team in the next debate.

    If you find that unreadable, I don't want you on my team in the next software project.

    --
    Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
  67. Re:Provided you have infinite hardware resources.. by swillden · · Score: 3, Insightful

    If your point was to make that part more readable, I think I want you on the other team in the next debate.

    If you find that unreadable, I don't want you on my team in the next software project.

    Well, I do have to say that the code would not pass my code review. Not because of the use of the ternary operator, because of the meaningless variable names. I'd also ask that "0" be replaced with "false".

    --
    Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
  68. When Go replaces C, C++ will just link to it. by 140Mandak262Jamuna · · Score: 1

    “I don't know what the language of the year 2000 will look like, but I know it will be called Fortran.” —Tony Hoare, winner of the 1980 Turing Award, in 1982.

    It is now 2017, is it called FORTRAN?

    We still compile FORTRAN source and make static libraries out of them. We still link with them. But there is no development in FORTRAN.

    If Go is able to deliver a kernel that is "not leaky" whatever he means by "leaky", we will get compiler directives that will deprecate and eventually disallow C compatibility. C++ compiler will build intermediate binaries compatible with Go based linker and loader. The sources that could not be migrated to disallow C will become unmaintained static libraries that are buried deep in the code base along with Fortran libraries, and IMSL and BLAS and other such esoteric code that have become living fossils without any upgrades and revisions.

    Go programmers will occupy the niche presently occupied by pure "C" programmers. The vast majority of developers will be working on higher level languages, C++ mostly.

    After dissing the prediction by "expert" why do *I* venture to predict?

    Hubris. Somehow I convince myself that because I am on the front line of development and see the incoming resume stream and skill sets, and know the magnitude of installed code (25,000 CPU hours for Level 2 testing, 2 to 4 million CPU hours for a complete release testing) I would be able to predict better than theoretical experts. But I could be wrong.

    --
    sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
    1. Re:When Go replaces C, C++ will just link to it. by iggymanz · · Score: 1

      You made a rather ignorant statement, FORTRAN development is still done in the realm of high performance computing, for some of the most interesting and complex problems mankind is tackling. that's why the FORTRAN 2018 standard is in the works.....

      Sure, its mainstream use is in libraries for which no superior replacement has been done, but maybe that also says something

    2. Re:When Go replaces C, C++ will just link to it. by david_thornley · · Score: 1

      I believe FORTRAN got decapitalized with Fortran 77. I've used FORTRAN, but I prefer Fortran.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    3. Re:When Go replaces C, C++ will just link to it. by 140Mandak262Jamuna · · Score: 1

      You made a rather ignorant statement, FORTRAN development is still done in the realm of high performance computing, for some of the most interesting and complex problems mankind is tackling. that's why the FORTRAN 2018 standard is in the works.....

      We do have a high performance development group and we do solve some of the most interesting and complex problems mankind is solving, our products wont build without the Intel Fortran compiler. Still the number of Fortran developers I have and the number of Fortran positions I call for is vastly out numbered by C++ developers. C can shrink like that. Not C++ that is my point.

      C++ compilers will unlink from C, deprecate C bindings, compile to a target for Go based link/loading. Some libraries could not be ported with the same level of performance. They will become living fossils like Fortran. A small team maintaining and building it. Some small improvements.

      Theoretical computer scientists will be appalled by the idea of this creaking huge superstructure being boot straped on to their elegant Go foundations. But the cost of rewriting C++ is so high, the benefit so small, it will not be done.

      --
      sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
  69. Re: 20% slower!???? Are you INSANE!!!!!!111???1111 by gnupun · · Score: 1

    You're a typical /. moron... assuming stuff without any proof. Thanks for lying, asshole.

  70. Good news for C++, I guess. by Anonymous Coward · · Score: 0

    Since ESR is a fucking moron.

  71. Re:Provided you have infinite hardware resources.. by squiggleslash · · Score: 1

    If you're a developer, that was considerably more readable than the COBOL-like version you translated it to.

    I could read it immediately: set B to not B if A isn't 1, else 0.

    Developers who become used to a particular language generally can read it as long as it's formatted correctly, which religionofpeas did. Even stuff like while(*d++=*s++); becomes second nature. The key isn't in avoiding symbols, which you're supposed to be able to just read if you plan to do any coding at all, but to ensure formatting and sane use of whitespace makes turns a string of symbols into a set of instructions.

    --
    You are not alone. This is not normal. None of this is normal.
  72. ERLANG / ELIXIR by Anonymous Coward · · Score: 0

    ERLANG / ELIXIR

  73. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    Zero machine-cost abstractions, maybe. High mental cost abstractions, certainly.

    I find Haskell has less mental cost than C++.

  74. Re:Provided you have infinite hardware resources.. by torstenvl · · Score: 2

    I think you meant: b = (a==1) ? 0 : ~b

  75. Re: Provided you have infinite hardware resources. by red_dragon · · Score: 2

    C does not have a boolean type. Instead it tests for truthiness by checking whether the value is zero (false) or non-zero (true). That bit of code might not make sense, but it will compile.

    --
    In Soviet Russia, Jesus asks: "What Would You Do?"
  76. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    The C version [a struct] is constrained to lay out the objects as three fields with no padding (this is visible in the language with sizeof and will break ABIs if it dynamically changes).

    This is just wrong. From the C99 standard, section 6.7.2:

    13 [...] There may be unnamed padding within a structure object, but not at its beginning.
    15 There may be unnamed padding at the end of a structure or union.

  77. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    The C version is constrained to lay out the objects as three fields with no padding (this is visible in the language with sizeof and will break ABIs if it dynamically changes). The Java version, in contrast, is allowed to put an unused padding field at the end of the struct. Why does that matter? If you want to vectorise the loop, then being able to guarantee 4-element alignment for every object in the array is a huge win. This is a legal transform for a Java compiler, but not a legal transform for a C compiler unless it can prove that no pointers to the array escape (and a few other constraints).


    struct RGBP{
          int R;
          int G;
          int B;
    #ifdef WIERD_PADDING_REQ
          int Padding;
    #endif
    };

    OK, yeah. There's no (so far as I know) guarantee the compiler will put them in that order in the object code, or someone won't fiddle with things later on. Maybe you can use a union with an array or getter/setter functions. But really, how much "simpler" is the corresponding java class going to be anyway?

  78. Few of those Rust "friends" are real companies! by Anonymous Coward · · Score: 0

    That list of Rust "friends" is pretty misleading, I think.

    Few of them are what I'd consider real companies. I define a "real company" as one that produces a usable product, has a significant number of paying customers, and makes a consistent profit.

    A lot of them appear to be extremely early-stage startups, which will most likely fail, if they haven't already.

    Some of those "startups" are probably no more than a lone college student who has fantasies about being an entrepreneur, and who threw together a logo and now thinks he has a "startup", despite lacking every other aspect of what's typically considered a business.

    Even the biggest names on the list, like moz://a, Dropbox, Coursera and OVH, really aren't that big at all and it sounds like they're barely using Rust in any meaningful way.

    I think that list of Rust "friends" actually shows how pathetic Rust's adoption has been. So far it has only attracted wannabes and minor players. Even a language like Go has a powerhouse like Google using it, at least.

    Nobody outside of moz://a appears to be using Rust in any serious way. At best it has been used experimentally. More realistically, its "usage" is just some college student's fantasy "startup" that someday, maybe, hopefully, possibly, will use it.

  79. Re:Provided you have infinite hardware resources.. by Ambassador+Kosh · · Score: 4, Interesting

    For HPC (high performance computing) I don't see C++ going anywhere. For HPC the only viable languages I see are C, C++ and Fortran since they have the best optimizing compilers.

    Mostly I use python for command and control with a simulator written in C++ and this seems to be a pretty common setup for HPC applications.Command and control often has a lot of code but is 1% of the compute time so write it in a high level language and then do the simulator is something that is FAST.

    --
    Computer modeling for biotech drug manufacturing is HARD! :)
  80. explain yourself, troll by Anonymous Coward · · Score: 0

    but that is not practical for large applications.

    your statement is meaningless drivel without some sort of evidence, but you don't have any

  81. Bigger risk for Rust. Moz://a is funded by Google! by Anonymous Coward · · Score: 1

    Just a couple of weeks ago Slashdot reported that moz://a has gone back to suckling on Google's money teat. Keep in mind that this is very likely moz://a's main source of income.

    So as far as I'm concerned, moz://a is effectively a department within Google at this point. In practice, moz://a's projects, including Rust and Firefox, only really exist thanks to the budget they get from Google.

    I'd expect Google to pull their financing of moz://a well before they'd kill Go. That means that Rust, which hasn't seen much real use outside of moz://a, could very well perish in such a scenario.

    It really doesn't help that Rust's hype is evaporating. And to top it all off, the most recent releases of Firefox that include more and more Rust code have been among the worst ever. Firefox 55 and 56 are often described as being very slow, and although Firefox 57 is supposedly faster compared to those dreadfully slow Firefox releases, it's still slower than its main competitors. In my opinion, Rust hasn't improved Firefox in any noticeable way, and may actually have made it slower!

    I'd trust Go's long-term future over that of Rust. There's at least some tangible, financial benefit for Google to keep supporting Go. On the other hand, a language like Rust exists almost as an accident at this point. If Google ever stopped funding moz://a, it could be a total disaster for Rust and anyone silly enough to consider using it.

  82. Re: Provided you have infinite hardware resources. by nasch · · Score: 1

    Programmer time is really expensive though...

  83. Re:Provided you have infinite hardware resources.. by coofercat · · Score: 3, Interesting

    A colleague and I were joking around one day, when a hardcore-dev (with a lot less humour, and chronic flatulence, as I remember) overheard us. He maintained that super-terse code is easier to read than the alternative. Since we were just messing about, we both just let him say his peace and then stated that the One True Language was of course Turbo Pascal 6 (which sort of ended the conversation).

    My take on it is that the terse syntax does make sense (more quickly) to someone who knows the syntax really well. If you don't know it quite as well, then the long-form is better because as OP says "the sentence would look wrong". Also, actual words are 'googleable' where as it's hard to lookup the meaning of "~->" or whatever. Thus, the long-form plays to more average programmers.

    The question then becomes... who should a language be for? For the super-expert, or for the midrange programmer, or possibly even the junior? IMHO, midrange is a good place to aim at because that's where the majority are, and if they're using your language then you'd want them to be able to do so reasonably easily and safely. That way, of all the billions of opcodes executed around the world as a result of your language, the majority of them will be reasonably safe and sensible.

  84. Re: Provided you have infinite hardware resources. by Anonymous Coward · · Score: 0
  85. Re:Provided you have infinite hardware resources.. by mark-t · · Score: 1

    Given that the performance of Rust is often inferior in peformance to doing the same job in C++, I'm not sure how you arrive at the notion that it has zero cost.

  86. this is fine by friesofdoom · · Score: 1

    So we are listening to a neo-pagan gun rights advocate who denies global warming. He seems like a perfectly rational bloke!

  87. Re:Provided you have infinite hardware resources.. by TheRaven64 · · Score: 3, Informative
    Okay, three of you have jumped on that, so let me be more explicit:

    A C compiler may add padding, but its ability to do so is constrained (or mandated) by the platform ABI. The layout of a struct is exposed directly in the language because you can ask for sizeof() the struct (which, if you subtract the size of all of the fields will tell you the total padding) and you cast a pointer to a field and a pointer to the struct to char*, subtract one from the other, and get the offset of each field. This means that it is effectively impossible for a C compiler to add padding to make optimisations easier (the only case in which they will reliably do it is for on-stack structs that are not address-taken).

    --
    I am TheRaven on Soylent News
  88. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    I find (a != 1) ? b=!b : b=0; much easier to read and quickly interpret than "if a is not equal 1 then set b equal complement of b else set b equal 0".

    If you want readability over efficiency, here's what I would write:

    b = !b;
    if (a == 1) b = 0;

  89. Re:Provided you have infinite hardware resources.. by TheRaven64 · · Score: 1

    There's no (so far as I know) guarantee the compiler will put them in that order in the object code

    There is no guarantee that the compiler will put them in the object code. There is, however, a guarantee that, if a pointer to one has escaped from a compilation unit then the layout will be the same for all compilation units (including, implicitly, ones that are in shared libraries that are dynamically loaded as plugins). In contrast, there is absolutely no guarantee of structure layout in Java, and typical JVM implementations sort the fields to have primitives and object references contiguous, to simplify GC.

    --
    I am TheRaven on Soylent News
  90. Why he's got it wrong at step 1 by Dr.+Crash · · Score: 2

    ESR is making an early invalid assumption - that "fast transparent garbage collection will happen".

    Sorry, no. The smartest people in the CS world - possibly the
    smartest in the world, period (specifically those at MIT AI Lab,
    Xerox PARC, BBN, TJ Watson, and Stanford) worked the GC problem
    for literally 20 years, throwing hardware at it, software, tagged
    architectures, secondary processors, all that.

    They never cracked it. GCing at realtime speed is just a tough problem.
    Unless ESR can show me code that can GC in faster than O(n) time
    AND not have to freeze the allocator process for O(n) time, he's just
    pitiably wrong.

    (and no, I don't count flip and sweep GC as workable in this, as it
    means that a buffer that DMA hardware is writing to will move without
    warning. Nor is "generational" GCing, all that does is to stave off the
    inevitable full-out GC for a few minutes to hours, which is fine for a
    hacker sitting at a terminal but no good at all for a self-driving car or
    SaaS server).

    Now, I could be wrong; if he *has* a realtime garbage collection algorithm
    then he deserves the Turing award.

    But I'm betting "not".

    1. Re:Why he's got it wrong at step 1 by loonycyborg · · Score: 1

      I think scope based lifetime management like C++'s RAII pattern are superior to garbage collection. GC looks like hasty and too general solution to me. Might work good enough for beginner programmers or with lack of performance constraints, but ultimately there is no such thing as free lunch.

    2. Re:Why he's got it wrong at step 1 by K.+S.+Kyosuke · · Score: 1
      What, Zing and friends don't make you happy? You must be very hard to please...

      Nor is "generational" GCing, all that does is to stave off the inevitable full-out GC for a few minutes to hours

      Who says it's 'inevitable'? Do you have a proof of impossibility of this? Until you show mathematically that this is impossible, I wouldn't throw around such strong words as "inevitable".

      --
      Ezekiel 23:20
    3. Re:Why he's got it wrong at step 1 by angel'o'sphere · · Score: 2

      You have no clue about GCs, nor has ESR ... so you arguing with it about it is moot.

      Hint: I can probably describe 5 real time garbage collection algorithms/variations from my mind, and implement one in about 3 days. Hm, perhaps one day ... but my C++ is rusty.

      Another hint: real time most likely does not mean what you think it means.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    4. Re:Why he's got it wrong at step 1 by Anonymous Coward · · Score: 0

      > Hint: I can probably describe 5 real time garbage collection algorithms/variations from my mind, and implement one in about 3 days. Hm, perhaps one day ... but my C++ is rusty.

      And still have microseconds to milliseconds level latency in real case applications, like every other garbage collector.

      He is right, in practice, no language with GC ever made it in the real time application world.

      You can fantasm as much as you want that it is possible on paper, it is not the case in practice.

    5. Re:Why he's got it wrong at step 1 by squiggleslash · · Score: 1

      "RAII is as effective a method of garbage collection is the rhythm method is an effective a method of birth control." Discuss.

      --
      You are not alone. This is not normal. None of this is normal.
  91. A Go-made program needs Go installed to run by Anonymous Coward · · Score: 0

    Or at least an "engine" with code hugging around it. If that's the case, then I have no reason to leave Python. I don't trust anything made by Google.

  92. Rust doesn't need a garbage collector by Anonymous Coward · · Score: 0

    Rust doesn't need a garbage collector because everything is tightly and explicitly scoped. Nobody who's written a line of real-time code imagines GC to be in our inevitable future and even in the kernel. Shudder! Maybe if GC were incremental and didn't go out to lunch it would be different, that is of course an implementation "detail", but one not properly addressed.

  93. Re: Provided you have infinite hardware resources. by Anonymous Coward · · Score: 0

    Why do you think that is a useful skill to have? Simple syntactical errors is something that the compiler can catch for us.
    It's better to be able to spot logical errors.

    If your compiler doesn't catch typing errors and lets them become runtime errors instead, switch compiler/language.

  94. C wasn't for those who needed safety ... by Anonymous Coward · · Score: 0

    C is flawed, but it does have one immensely valuable property that C++ didn't keep -- if you can mentally model the hardware it's running on, you can easily see all the way down

    You're goddamned right C wasn't type safe or memory safe, because it wasn't meant to be. C grew out of the real problem of needing a programming language that was very close to the assembly language while being at a higher level, and was created to allow bare-metal OS programming direct to the hardware. It so closely follows the assembly of a PDP-11 CPU it isn't funny.
      Having cut my teeth writing code at that level in C, and had to manage my own memory, interchangeably call a block of memory many different things with casts and pointers and bit operations, it was an awesome language.

    C has no safety net whatsoever, nor it is meant to. What it isn't is a high-level language for people who need to be hand-held with type safety and with huge gobs of programming libraries to do all of the work for you. The things C excels at are for people who can operate without a net, close to the bare metal of the machine, where both writing tight code and having the knowledge and flexibility to do something like an "array of pointers to pointers to printf like functions" or any number of strange stuff people did in C on a regular basis.

    There are many higher level languages suitable for people who need type safety, training wheels, and safety guards and libraries of functionality. And those languages have their place in the world and should be used where applicable.

    But there comes point where you're doing certain kinds of tasks, that C will always be the required tool ... precisely because it's got no safety net and is pretty much suited for close to the hardware type stuff, where type safety and training wheels is just going to be too slow. You're not going to write an interrupt handler for a piece of hardware in some high level namby pamby language which makes sure you don't poke yourself in an eye and which imposes vast frameworks and type checking for you -- because it will be too fucking slow.

    I'm definitely NOT saying all things should be written in C. But I definitely AM saying you learn things as a C programmer that you simply cannot learn in other languages, because it requires a level of understanding many languages go to great lengths to remove for you.

    This is why I've met far too many programmers who don't really know what the hardware and OS really does, and are just simply used to pulling in yet another library to solve the hard parts. They've had so much abstracted away for them they have very little real understanding of what is actually happening, and in some cases that limits them in ways which is hard to overcome.

    Programming in C is like orienteering or making a fire from scratch .. there's a foundational aspect to it which is valuable to have, and which can give you a better understanding of things when you're not doing things which require it.

    People who complain C isn't type safe have missed the point. We wouldn't have UNIX and Linux or most modern OS's without C, because it really is that important. Don't decide retroactively that because it doesn't hold your hand and look out for your safety there's problems with C. The problems people were solving in C pretty much required you to really know what the hell you were doing.

  95. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    Which of course makes the assumption that you're dealing with a boolean, and not a pointer, or some other data type. 0 often maps nicely only many data types, but 1 does not.

  96. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    Right, Unix/C was written in the early 1970's before good optimizing compilers. That ternary expression is almost the same as the assembler operation to do it, e.g. (~b) means "bit-complement the value of B in some register". On the other side is the COBOL sentence-level "if a is not equal 1 then set b equal complement of b else set b equal 0", which is too much code. Languages should have readability to humans over syntax that is computer-friendly.

  97. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    The C version is constrained to lay out the objects as three fields with no padding (this is visible in the language with sizeof and will break ABIs if it dynamically changes).

    That is compiler specific, just because the C compiler you used doesn't add padding doesn't mean that the C compiler isn't allowed to.
    It can make every field into a 32 bit value if it wants to. This could be beneficial on the ZPU architecture where byte access often is emulated.
    Dynamic change doesn't have anything to do with that. The structure size is decided at compile time.

    Yes, it will break ABI if you use different compilers that pads or packs structs differently. That is why many compilers gives you a lot of control in how it handles the structs.

  98. Re:20% slower!???? Are you INSANE!!!!!!111???1111! by Anonymous Coward · · Score: 0

    That's why they use Java (Android) or Swift (iOS).

    No, the reason developers use those languages is because they are forced to by Google respectively Apple.

  99. Rust has no garbage collection? by mnooning · · Score: 1

    I do not use Rust but I read enough of the book and saw enough of the tutorials to know that Rust has no garbage collection because it is not needed! The borrowing concept allowed a compiler to be written that prevents the things that cause memory leakage in the first place. No garbage collector is not a negative thing in this case. It is a very, very great plus, Does ESR really not know that?

  100. Re:Provided you have infinite hardware resources.. by Zobeid · · Score: 1

    English is a horrible mess that's unsuited to programming. (Which might, arguably, be why AppleScript was so widely disliked. It tried a little too hard to follow the natural language metaphor.)

    However, we definitely could do better, and we could make code more explicit and more readable. Sometimes I get the impression that serious computer language geeks are afraid to even talk about syntax. The subject is too lowbrow. We all know that language geekery is all about impressing other language geeks with your knowledge of abstruse comp-sci concepts. (Just scan the other comments on this piece!) Easily readable syntax isn't sexy like that. A highly readable language might even suffer the stigma of being "dumbed down" and unsuited to Real Coders.

    I remember reading a comment from Chris Lattner explaining why Swift syntax is so C-like. We could have made it more readable, he said, but we felt it was more important to keep it familiar-looking to C programmers! The implication (to me) was that readable syntax is a frivolous matter, not worth expending any concern or effort on.

  101. LARP by ponraul · · Score: 1

    He should add "programmer" to his LARP resume

  102. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    The problem is that we've added layer upon layer such that we still need C to write the OS underneath even though CPU's are a thousand times faster than when C was started. You'd think we'd have enough headroom by now.

  103. Re: Provided you have infinite hardware resources. by KramberryKoncerto · · Score: 1

    If I put objects in objects in objects in classes in python or java it can blow up in my face. I don't know if Rust is genuinely "zero cost", but at least if there's any slowdown from my compulsive OO and encapsulation habits it hasn't been nearly as bad.

  104. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    [...] the equivalent of delivering a pack of soda with a semi [...]

    Oh, man. When I was in junior high, we heard rumors of Jolt Cola giving guys erections, but I just thought it was an urban legend.

  105. Re:Provided you have infinite hardware resources.. by Yunzil · · Score: 1

    You'd immediately spot an error in the second because the sentence would look "wrong".

    No I wouldn't, because I'd have to read the sentence, then read it again because it doesn't quite read like correct English. Then say, "wait, what?" and read it again.

  106. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    In junior high? You'd probably have an erection anyway if you drank nothing but tap water.

  107. Re:Provided you have infinite hardware resources.. by angel'o'sphere · · Score: 1

    That is not true for modern processors and modern C.
    Structs will always be padded and filled up to the next best fit to make its size a multiple of the register size, unless you add zero sized bitfields to indicate that you don't want padding.

    --
    Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  108. Interoperability by darkain · · Score: 1

    The main issue that is never addressed in these "OH, c/c++ is going to die" sorts of arguments is interoperability. At any point in time, C++ code can fall back to C for any of its shortcomings. And at any point in time, both C++ and C can fall back to inline assembly for both of their shortcomings. So this is already three separate languages playing very nicely with one-another. And then on top of that, most other languages out there to be successful have some sort of either C or C++ compatible interface. Need a new PHP module? They're written in C. Need a new Lua module? The same, it falls back to C. Need dynamically loaded/unloaded code at run time? Shared objects and DLLs using the C calling convention, regardless of which language they're compiled from initially. This trio of languages is the foundation of everything else on the computer cooperating and working together in unison, whereas all other languages are trying to be walled gardens upon which they can only access themselves and nothing more.

    The other issue to a lesser extent is that C and C++ are strictly languages, not libraries. The compilers provide standard libraries, but they're never included by default. This allows for some interesting things to happen, such as the community building replacements for various "built-in" libraries. This also allows for the "built-in" libraries to be maintained and updated separately from any one particular compiler. This level of flexibility is what truly gives C and C++ their powers.

  109. Why not ask him important questions? by Eunuchswear · · Score: 1

    Important questions like "does this look like FORTRAN to you"?

    --
    Watch this Heartland Institute video
  110. Re: Provided you have infinite hardware resources. by angel'o'sphere · · Score: 1

    You can not put objects into objects into objects in Java or Python ...

    --
    Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  111. uhh by Anonymous Coward · · Score: 0

    Considering ESR is generally considered to be, on a technical proficiency level, not a particularly good programmer, why does his opinion on this hold enough weight to merit a Slashdot post?

  112. Re:Provided you have infinite hardware resources.. by robkeeney · · Score: 4, Insightful

    People who do electrical engineering learn to read and understand the funky symbols they use in electricity. We don't expect them to write out everything in plain English. It's the same with programming. Your Pascal-y pseudo-code took how much more space and time to convey no extra information? Your pseudo-code actually took longer for me to parse and understand than the C version.

  113. Re:Provided you have infinite hardware resources.. by TheRaven64 · · Score: 1

    Please read my reply to the other poster. TL;DR: The C compiler is required to either add the padding required by the ABI, or prove that no pointers to the type escape from that compilation unit. It is not free to add padding to improve optimisation unless it can prove that no pointers to the type escape (which is typically impossible).

    --
    I am TheRaven on Soylent News
  114. Re: Provided you have infinite hardware resources. by TheRaven64 · · Score: 1

    C has had a _Bool type for 18 years and a stdbool.h header that defines bool to be _Bool.

    --
    I am TheRaven on Soylent News
  115. Use std::vector by Anonymous Coward · · Score: 0

    You can use a data structure that was designed for runtime allocation.

  116. Re: 20% slower!???? Are you INSANE!!!!!!111???1111 by Anonymous Coward · · Score: 0

    You're so mad. One wonders what you're compensating for.

  117. ESR is a nobody though... by JoeDuncan · · Score: 1

    So can we please stop reporting on every damn stupid thing he does or says like it's actual news?

    The man's just an internet crank who happens to like Linux, enough of him already.

  118. Write a build-time program by Anonymous Coward · · Score: 0

    Why not write a program (in whatever language you like) to be run at build time to compute those values and then output the necessary C++?

    1. Re:Write a build-time program by bzipitidoo · · Score: 2

      Can do that, yes, and I've thought of going that route. But why not have a programming language that's expressive enough so that you don't have to resort to code generation, if it's not hard to do? And it's not hard. Many already do it in limited ways. In C/C++, macros and templates come to mind as means of generating code. Why not do more? Are they afraid of the compiler having to make multiple passes over the source code?

      --
      Intellectual Property is a monopolistic, selfish, and defective concept. It is "tyranny over the mind of man"
  119. Running a real software project by david_thornley · · Score: 1

    It's all very well to say "well, don't do that" about things....

    We're talking about simple code style rules, easily enforced with code reviews or static checkers. These are easier to do in larger projects than in one-person ones. These rules won't make people write good C++, but they will eliminate some large classes of errors.

    If you've got a lot of legacy code that is in the wrong style, and it's C++, you can change it slowly and make it more reliable. We found a few bugs simply by adding "override" to our function definitions, for example.

    If you can't get your programmers to follow a few simple rules of style, you're screwed no matter what language you're using. If nothing else, you'll find yourself with piles of code you can't read easily that could hide myriads of bugs.

    --
    "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
  120. Re:Provided you have infinite hardware resources.. by networkBoy · · Score: 2

    depends if b is expected to only be 1/0 at the end of this function even if it *may* be some other true value (why this would be the case I do not know), also !b is going to be faster than ~b in many cases. But! write it as it makes sense and profile to see if that speed is an issue or not.

    Given the a b operators (yeah I know this is an example, but I'm running with it) this is likely an inline function that will be called very heavily in a nested loop or somesuch... as a result the speed of operators can have a very noticeable impact.

    True story:
    Had a co-worker that did something very similar to this, but b was a UINT64 and he used it to store a bool. used ~ operator to toggle it.
    When he needed to make it look like he was busy and improved performance he switched it to a UINT32, then UINT16, then UCHAR, then to use the ! operator instead of the ~ operator.
    I didn't rat him out because our manager was a dolt and my co worker was actually working on a hard problem, but manager was one of those "didn't see an improvement, so you were wasting time" people.

    --
    whois gawk date unzip strip find touch finger mount join nice man top fsck grep eject more yes exit umount sleep dump
  121. Oh look, it's this subject again... by Anonymous Coward · · Score: 0

    I wish it was only once a decade this topic reared its head, but it seems like it's once a month.

    Replace this, don't use that, the other one is OK but that one there is better... hey look, a new language that solves all the problems of C! I'm sure this will seamlessly and effortlessly replace the many trillions of lines of legacy code and function without any objective flaws whatsoever!

    C++ is fine. Java is fine. Rust isn't that bad. Go is certainly a programming language. Nothing is perfect and the pursuit of perfection will only generate another imperfect option to choose from.

    C is not going away. Get used to it. If you don't like it then that's fine and everyone else who does should get used to that too. There's just so many options... so many... I don't see why this is even an issue at all anymore. Programming is like any other engineering field: If it's broken it gets fixed, if something new and better comes along you can replace the old and busted when it becomes cost effective.

    Any other approach is hubris, pride, vanity or any combination of those things.

    1. Re:Oh look, it's this subject again... by Pseudonym · · Score: 1

      In the case of ESR rants, it was twice this month.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
  122. Re:Provided you have infinite hardware resources.. by gustygolf · · Score: 1

    I think you fucked up your use of the ternary operator in your OP.

    If you're throwing away its result, you're doing it wrong.

    You never need an assignment inside the ternary. It always belongs on the outside.

    --
    "Slow Down Cowboy! It's been 58 minutes since you last successfully posted a comment" -- slashdot, driving users away.
  123. The wrong problem; use the right tool for the job by redmasq · · Score: 2

    While I certainly not found of C++ myself, I can certainly code in it. As it stands, most of the problems that I have to solve on a regular basis does not involve usage of that language directly. That said, I still think there is use for it, even beyond legacy compatibility. I typically work on user-land applications, data ETL jobs, and web services. For those, Java, C#, SQL, and the occasional bit of Python each are well suited for the job. There is less cognitive overhead to simply code for solving the problem, and then tweaking for minimizing performance issues and garbage-collector/resource leaks.

    I have, on occasion, needed to interface with low-level hardware. In a Windows environment, C++ typically proves to be an excellent tool for the purpose. For the same purpose in Linux and DOS, I typically use "old fashioned" C if not using any APIs/libraries that would make C++ the better choice. I do not mind mind managing my heap in those cases and for C++ I can make use of RAII (stack).

    This is not to say the Rust and Go (which I have not got around to trying) are bad choices for a project; however, I would not simply assume they are a silver bullet for a problem. I will also mention that sometimes a sub-optimal tool can be used for the job in a pinch. In the physical sense, I would normally use a hammer for a nail and a screwdriver for a screw-- I have used a hammer to beat in a screw and I have used the back of a screwdriver to insert a nail (and lamented the entire process).

    Now, concerning ESR's position, I certainly see his reasons. Since my thoughts are difficult to articulate, I shall make a comparison to my browser: Firefox. I first started using it (under the name of Phoenix) because it was not Internet Explorer, but lighter weight than the then bloated Mozilla-branded browser. It had problems and it was lacking features, but it did provide enough customization that I was comfortable using it. Since then, missing features were added, security holes were patched, features that I had liked were removed since they were either troublesome or not popular, and it has gained bloat (likely to fulfilling features) similar to its predecessor. Other browsers are starting to look "shinier" to me. C++ is a language, but it, like application, will evolve to the niche of the target audience. Individual users, whether speaking of applications such as browsers or languages, will each have different needs and different limitations they are willing to tolerate. I prefer to focus on solving the problem, but I do not mind taking on the extra responsibilities if it brings me benefit. I have had talented co-workers that are absolutely allergic to idea of managing their own memory, but loves to "create clean elegant solutions." I have also had other talented co-workers that absolutely refuses to trust language/library provided mechanisms such as garbage collection, but they have the attention to detail and the background of knowledge to rapidly create lean and correct solutions to problems where they do have that level of control.

    For the TL;DR, have a reasonable set of ability to use for the time and effort you are willing and able to invest in the niche that you can or want to fill. Find the right balance of flexibility and proficiency that matches the limited resources to invest and the opportunities available. Also, remember that ESR is a quasi-public figure with strong, sometimes bitter opinions: earnestly consider them, but take them with a grain of salt. I will also note that concerning his mention of the futility of trying to predict the future (the next big language), it is like predicting the stock market in that some things will stick around forever, but have only modest returns; however, a penny stock have the possibility of a minimal investment with a big return, but also carries a high risk of just being a useless waste of resources.

  124. Re:Provided you have infinite hardware resources.. by HornWumpus · · Score: 1

    He gets 'ranked and rated' by LOC/day you insensitive clod.

    --
    John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
  125. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    God I love the ternary.

    Then again, I love F#'s match even more.

  126. Can Someone Clue Me In? by Anonymous Coward · · Score: 0

    Can someone clue me in about why Equivalent Series Resistance has anything to do with taking my trash to the dump? kthxbai

  127. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    Superflous verbage does not more readable code make.

  128. Re: Provided you have infinite hardware resources. by Anonymous Coward · · Score: 0

    Though there is a macro that functions like bool in stdbool.h

  129. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    I'd also ask that "0" be replaced with "false".

    I'm so hoping that was a joke.

  130. Embedded by Anonymous Coward · · Score: 0

    When I'm working in a low level language, I absolutely abhor the compiler doing stuff behind my back. Padding, re-ordering execution, all that garbage does is give more chances for bugs. I really wish we could have a language whose specification would _never_ say "implementation dependent". How many times have you seen code that defines their own "BYTE" or "INT16" because the C language allowed it to be different.

  131. Re:Provided you have infinite hardware resources.. by angel'o'sphere · · Score: 1

    Sorry, that is plain wrong.
    Basically everything regarding padding - and even ordering of fields - is implementation dependent and not specified in any standard.

    Supposing short is 16bits and int is 32bits and long is 64bits and word size/register size is 64bits, code like this:

    struct {
          short s1;
          long l1;
          short s2;
          int i1;
    };

    The above would be heavily padded ...

    And can be reordered e.g. into:

    struct {
          short s1, s2;
          int i1;
          long l1;
    };

    To avoid that, you need to do your own padding with 0 sized bitfields.

    --
    Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  132. Dev time is a one-time cost by Anonymous Coward · · Score: 0

    So, I'd rather pay more for continuously better performance.

  133. Re:Provided you have infinite hardware resources.. by gbjbaanb · · Score: 1

    He's wrong, as anyone familiar with perl will tell you, but he's also right - the "code" rather than the "English" syntax is more readable once you progress above beginner levels.

    Maybe the ternary operator was a mistake though, or maybe a mistake is to chain operations together on one line without some form of delimiting spacing.

  134. Re: Provided you have infinite hardware resources. by gbjbaanb · · Score: 1

    not compared to the time of a million users though.

    Its just that those creating the programs don't pay for the user's time (unless it gets really bad and a competitor product appears), or the server time for the extra hardware required to handle the complexity.

  135. Ramblings. by AnotherBlackHat · · Score: 2

    The thing I note about better programming languages is that they mostly aren't better.

    I've occasionally thought "This would be much easier to write in Perl than C."
    I've never thought "This would be much easier to write in C++ than C".

    Fewer lines of code doesn't mean much.
    Thousands of line of assembler, is roughly as hard to write as hundreds of C.
    A six line function can often replace a 500 line table.
    Copy and paste code instead of using subroutine calls, and you too can be writing 500 lines of code a day.

    It isn't significantly harder to write in assembly, that is not why we avoid writing assembly code.

    IMO the successor to C won't be a higher level language at all.
    It will be a language that gives as low, or even lower level access, but is more portable.
    Something that let's me specify endian-ness, or bit rotation, or do atomic operations without the need to invoke a semaphore/system call.

  136. Re: Provided you have infinite hardware resources. by nasch · · Score: 1

    Obviously there's no single right answer, but unless you have a good, specific reason to think Solution A will not be "fast enough" then choosing Solution B for better performance at the expense of slower development is probably a bad idea. With processors as fast as they are today, even on a phone "not very fast" is very often still plenty fast. I do Android development in Java, so I'm using a language / VM with a reputation for being slow on a platform with a processor that is at best not optimized for high performance, and I don't recall ever encountering anything the user had to noticeably wait for other than making network calls to some other system. For a different situation performance could be a much more significant concern and maybe it's worth it.

  137. Re:Provided you have infinite hardware resources.. by swilver · · Score: 1

    It's not less readable. Your Pascal is way too verbose, giving you the illusion that just because it sounds like English you actually understand it.

    These are not the issues C/C++ programmers are having trouble with, because these are beginner problems.

  138. Re: Provided you have infinite hardware resources. by swilver · · Score: 1

    Yeah, smart pointers...

    Except there're not so smart. They're about as smart as first generation garbage collectors which used ref counting, meaning they can't deal with cyclic references.

  139. Re:Provided you have infinite hardware resources.. by swillden · · Score: 1

    I'd also ask that "0" be replaced with "false".

    I'm so hoping that was a joke.

    Not a bit. Using the explicit boolean literal makes the author's intent clearer.

    --
    Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
  140. Re: Provided you have infinite hardware resources. by Anonymous Coward · · Score: 0

    Not built in per-se, though stdbool does provide macros that act in its place if you want to use bool in C.

  141. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    Frameworks are often a good answer to that... as long as the developer understands the nature of the framework, its limitations, the licensing model, its viability, and thus can assess the consequences of using it.

    And that's exactly the problem. More often than not the framework is being touted by a skills-weak 'developer' who DOESN'T understand the nature of the framework, it's limitations, or it's actual applicability. Frameworks are great when they're used properly. The hate against them comes when they're too often seen being used as crutches instead.

  142. Re:Provided you have infinite hardware resources.. by bzipitidoo · · Score: 1

    Yes and no. I agree that wordy version reminiscent of COBOL or Pascal is bad. Just because English is currently the language of choice for international communication doesn't mean we should accept gratuitous use of it in programming languages. Imagine that in Latin. Still readable?

    The key isn't in avoiding symbols

    Oh yes it is! Lots of Idiotic Spurious Parentheses? Tell me which format for accessing an element of a multidimensional array is easier to read, [a][b][c] or [a,b,c]? How about XML and HTML, especially properly written markup with every closing tag included?

    while(*d++=*s++);

    That's antiquated string.h style library crap that doesn't even use the appropriate library function, strcpy(d,s);! Yeah, yeah, it computes the length as it copies, but better to have kept the length which was surely available somewhere somehow beforehand. Did you know that the null terminated string format required to make that work is regarded as one of the biggest mistakes of C? Maybe d and s are not char, but if they are, one byte at a time is a really rotten, slow way to copy a block of memory. Should at the least copy a 32bit word at a time. Or use the memcpy library function, which just might contain a whole lot of optimizations.

    --
    Intellectual Property is a monopolistic, selfish, and defective concept. It is "tyranny over the mind of man"
  143. Downstrean problems start upstream. by Anonymous Coward · · Score: 0

    It's a poor craftsman who blames his tools....

    1. Re:Downstrean problems start upstream. by Anonymous Coward · · Score: 0

      It's a poor craftsman who blames his tools....

      And it's a fool who believes in absolutes like that being always true.

  144. Re:Provided you have infinite hardware resources.. by Tough+Love · · Score: 1

    Do you have any level of competence in it?

    --
    When all you have is a hammer, every problem starts to look like a thumb.
  145. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    int l (S* s, T** t) { return s ? (t = s->sub, 1) : 0; }

  146. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    Why are we debating the readability of a ternary operator? Are you all pansy suck-ass python programmers or something? But really:

    b = (a==1) ? 0 : !b

  147. Re: Few of those Rust "friends" are real companies by Anonymous Coward · · Score: 0

    Yeah. You are full of it. Constructing a situation without proof, then generalizing to 100 percent.

    Let me guess, your paymasters live off the cyber war domain created by C?

  148. Re: Provided you have infinite hardware resources. by Anonymous Coward · · Score: 0

    That is a lame excuse for the use of C. There are few reasons why rust and swift programs should be much less efficient.

    Even java code from capable sw engineers is close to c speed. See language shootout.

  149. Re: Provided you have infinite hardware resources. by Anonymous Coward · · Score: 0

    Bullshit. Just because the cheapo operating systems you KNOW are all written in C means zilch.

    The have been very successful large computer operating systems written in Algol and Pascal. Unisys, icl, HP mpe. Look it up.

    Unix is a regression as compared to Algol mainframes.

    Msft has singularity OS, written in C#.

    C and unix have made computers much less secure than they need to be.

  150. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    Do you need your diapers changed with that also? Python programmers are so pathetic...

  151. Re:Provided you have infinite hardware resources.. by Mr0bvious · · Score: 1

    Really? I can read, comprehend and spot mistakes in:

    b = (a != 1) ? !b : 0;

    A lot faster and easier than:

    begin
        if a is not equal 1 then set b equal complement of b else set b equal 0
    end

    Or are you trying to play on the fact you presented an incarnation of a ternary operator that is not common?

    I find it hard to believe that anyone with a passing knowledge of the ternary operator would prefer your verbose version.

    --
    Never happened. True story.
  152. infrastructural scope creep by epine · · Score: 1

    Anything that allows us to reduce errors, increase functional complexity, reduce development time, ...

    C++ reduces development time when it achieves in one thread what another language requires complex concurrency to handle.

    Sometimes not using C++ causes infrastructural scope creep.

    When a small team of C++ programmers knocks it out of the park on a mission critical tight loop, that leaves many other machine resources free to run fat VMs with memory safety guarantees (and any manner of other sissy rails), and to run languages that excel in readability for the benefit of larger, less elite teams.

    I'm sure it wouldn't add any infrastructure code at all if Google suddenly needed to add 20% more computer nodes to their typical data center because they had eliminated all their C++ out of some misguided obeisance to training wheel purity.

    1. Re:infrastructural scope creep by epine · · Score: 1

      Concerning my previous comment, just this weekend I listened to the following podcast:

      Intel C++ Compiler with Udit Patidar and Anoop Prabha — 27 April 2017

      This wasn't my favourite episode. (I could have done a better job explaining the difficulty of tuning code across SMP, multicore, NUMA, and a many-levelled cache hierarchy. The guest seemed to veer into buzzword bingo.)

      But this episode does do a good job of driving home just how much performance one can leave on the table if not using C++, combined with high-performance C++ tooling.

      The objective with the Intel compiler is to get 20% from the compiler alone (over clang and GCC), which combined with their performance optimization suite can often obtain a full order of magnitude.

      But don't feel bad. ESR is equally clueless.

    2. Re:infrastructural scope creep by Anonymous Coward · · Score: 0

      And I find myself asking the question "Is ESR really relevant anymore?"

  153. Re:Provided you have infinite hardware resources.. by epine · · Score: 1

    The advantage of the ternary operator is that you only need the LHS part once, which helps if it's a more complex variable.

    Any complex expression one retypes for no reason is another potential bug. Especially in C++ where complex lvalue expressions abound.

    Furthermore, every nested if statement is another mental simulation, rather than the far more potent algebraic reasoning. However, if you've only got one hammer (mental simulation), then I guess it's right and proper that everything dresses up like a nail.

  154. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    Just because you like to write contrived code that requires a second look doesn't mean C can't have code that is much easier to read than your "english" version.

    if(a! = 1) b = !b else b = 0

    When I was 8, I tried Basic, failed miserably at it. So I picked up ASM. Much easier. Actually, ASM was quite natural for me. It mirrored the mental model I had about how I thought CPUs worked. I don't "write code", I tell computers exactly what I want in an unambiguous way.

  155. Go is a sign that the old beliefs are breaking by snadrus · · Score: 3, Interesting

    GC was hacked-on for decades to no avail (in bringing it low-level).But now here it works well (very fast, concurrent).
    What changed? The language spec was made very simple.

    Compiling was a very tricky, slow business. Now here it's fast and relatively simple.
    What changed? A simpler language. Smart people who know which options to take away.

    Only painfully low-level languages could work with raw memory pointers. Now we have that in 2 friendly, "default-safe" languages.
    What changed? Realization a lot of power comes from low-level operations.

    So C & it's layered C++ will break as safer variants with the same power begin to exist.

    High level languages depended on dozens of C libraries and libc. Go needs none of those.
    What changed? A realization this is important.

    A fork of Go now runs without a kernel on bare-metal ARM. That's the right space to grow into a kernel-module-capable language. Languages aren't fast or slow, their implementations are. Go's ease of portage suggests it could show up in the kernel.

    --
    Science & open-source build trust from peer review. Learn systems you can trust.
  156. Re:Provided you have infinite hardware resources.. by Anonymous Coward · · Score: 0

    Same for math symbols.
    Imagine a mathematical prove in plain english. Well, it is possible, I think Euklid made his proves in plain greek.

  157. Re:Provided you have infinite hardware resources.. by TheRaven64 · · Score: 2

    Basically everything regarding padding - and even ordering of fields - is implementation dependent and not specified in any standard.

    There are two relevant standards: the C language standard and the platform ABI standard. C compilers must comply with both for anything that is intended to interoperate. The platform ABI standard places much stricter requirements on structure layout than the language standard. This is important because the following is allowed in C (from your example):

    In one compilation unit subtract a pointer to start of the struct from a pointer to the the l1 field and pass it to a function in another compilation unit.

    In another compilation unit, construct a new instance of the same struct, cast the pointer to a char*, add the offset, and then cast it to a pointer to long, and assign to it.

    The result of this must be a version of the struct with the l1 field assigned. This is a guarantee of the C language, and the platform ABI standard provides the rules that allow it to work between different compilation units from different compilers (e.g. in different libraries).

    Oh, and the C standard actually does place some constraints that prevent the reordering that you describe. If you look at paragraph 6 of section 6.5.2.3, you'll see that, if a two structs start with the same fields then it is permitted to access the fields in either from a union. By induction, this means that struct fields must be ordered from the start, because anywhere else in the program (including other compilation units into which the compiler has no visibility) I can have structs that contained all of the prefixes of your struct (short, short long, short long short) and can declare a union of them and your struct and access the fields through them (and 6.7.2.1 paragraph 15 prevents there from being any padding at the start, so s1 must be at offset 0).

    --
    I am TheRaven on Soylent News
  158. Re: Provided you have infinite hardware resources by Zero__Kelvin · · Score: 1

    Stop talking now. You sound very foolish.

    --
    Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
  159. Packaging, modularity, build tools by dremon · · Score: 2

    Why nobody mentions such valid and important points as packaging, modularity/reuse and build tooling?

    Both C and C++ suck in this regard. Integrating 3rd-party project is usually an exercise in self-control and calm-keeping.

    Autotools, CMake, Make, VS Studio, Ninja, Meson, Scons, whatever shit, a new Grand Shiny Build Tool is coming every year as The Only Solution.

    No versioning. Everything is manual - binary dependencies, source dependencies, all has to be done manually for every project, with fuckload of weird compiler switches and preprocessor directives.

    Most of the modern languages have acceptable solutions for that (I love Rust and crates.io in particular) - not perfect perhaps but working, except for stupid C/C++ legacy shit, and the fucking committee just keeps adding template madness instead of sanitizing it. The C++ compile times are getting bigger with each revision because another fuckton of header files are added.

  160. I don't care if he hates it by Alex+Lust · · Score: 1

    Or any other big name professionals. There are plenty of others who love working with it. I mean, look at this topic, well over 500 posts already. Doesn't that tell you something? C++ isn't going away any time soon. Neither is plain old C. Those corporations who push for their alternative languages still use C++. And will use it in future. Now if I'm wrong, and indeed, none of their devs write a single line of C++ code in the next 10 years or so, and I mean not a single one...well, then I'll be truly amazed.

  161. C++ by alainbastien · · Score: 0

    I've been using Borland C++ since 1998 now RAD studio, I really think the programming language doesn't matter but what is to be acheived and how fast it can be coded. The results that count. In RAD Studio the possibilities are endless. Now Android, Linux and even iOS support

  162. C++ is as simple as possible, but no simpler. by HuguesT · · Score: 1

    C++ is a universal language that can express very abstract computing, and has tight speed and size requirements for it resulting code so that it can be used in embedded application, operating and critical systems. One day someone will produce a formally verified C++ compiler (such a C compiler already exists), and it will be a safe language too.

  163. Garbage Collection by Agripa · · Score: 2

    Eventually we will have garbage collection techniques with low enough latency overhead to be usable in kernels and low-level firmware, and those will ship in language implementations.

    How long have they been working on low latency garbage collection? If they have not developed it after decades of basically static hardware, then it will never exist. Garbage collection will always have lower performance than the alternatives so it is not suitable for low level code.

    I agree with ESR that C and C++ are flawed but no modern language has solved those flaws either so I do not care.

  164. Re:Provided you have infinite hardware resources.. by redmasq · · Score: 1
    My experience is that readability depends upon the quality of the code itself. Python, for example, while usually lending itself to being readable can be very difficult to read when poor choices are made with coding standards or at the very least they are not followed. This is particularly true when using the "more advanced features."

    In regards to your sample:

    while(*d++=*s++);

    If no reason was given, I would quickly demand:

    strcpy(s,d); /* include string.h above and do not use with std::string */

    Unless optimized inline, there would be extra work on the stack for the call, but someone unfamiliar with the idiom or the subtleties of operator precedence (or C lacking a dedicated bool type) of the original sample will have trouble. Yes, a veteran C/C++ programmer would recognize it instantly, but for crunch-time, it is not that unusual for a "loaner" to be attached to the project that normally uses a different but similar language, e.g., a skilled Java or C# person that knows what a pointer is. The latter example I provided has a clear purpose. Of course, extra help worth their salt would have the sense to look it up, assuming they aren't on their last drop of liquid motivation while burning the midnight oil.

    This is related back to your mention of:

    The key isn't in avoiding symbols, which you're supposed to be able to just read if you plan to do any coding at all, but to ensure formatting and sane use of whitespace makes turns a string of symbols into a set of instructions.

    I am just adding that it helps to be mindful of having good naming, try to use standard libraries (except for when there is documented good reason not to do so), document when doing something esoteric (when cannot be helped), and keep the "clever" to the obfuscation contests and proof-of-concept snippets.

    For the TL;DR, having good conventions (whitespace, naming, library usage, etc), inline documentations (and actual written documentation, please), reasonable communication concerning standards, and clear expectations can allow for C/C++, or most other languages for that matter, to be maintainable even in the largest of projects.

  165. Re: Provided you have infinite hardware resources. by gbjbaanb · · Score: 1

    I suppose client stuff is constrained by graphics, but I tend to think in terms of server software - and efficiency means the difference between serving a heap of users and a load of users, the difference can be significant.

    Now sure a lot is algorithmic, not language these days, but I find that the "easy" languages are the ones laden down with layers and layers of abstractions which fall into the category of bad algorithm practices.

    Besides, the issue shouldn't be "this language is easier than others" as all you do is make it quicker to develop shitty software by untrained people. The experienced developers are just as quick in their favoured language as any, so an old experienced C++ dev with a framework he knows will be no slower than the Java developer with a framework he knows, at that point it starts to be the abstractions that come into play. For example, if I as a c++ dev did some DB access, I'd writ e a sproc and call it via native calls. If I do C# work, I'll use entity framework that adds a massive amount of overhead to every call. The EF version is quicker to type out, but not by such a significant amount, particularly when you consider how long I take to design what the functionality should be in the first place!

  166. Re: Provided you have infinite hardware resources. by nasch · · Score: 1

    efficiency means the difference between serving a heap of users and a load of users, the difference can be significant.

    That is true, though you may be able to throw more money at the problem to overcome inefficiency. Buying more hardware may or may not be a good solution.

    The experienced developers are just as quick in their favoured language as any

    That sounds like a controversial claim. No programming language has any efficiency advantages over any other? I'm not buying that.

  167. Re: Provided you have infinite hardware resources. by Anonymous Coward · · Score: 0

    Even java code from capable sw engineers is close to c speed. See language shootout.

    Did you mean this shootout where the C (gcc) benchmarks run on average 2x faster than Java?

  168. Re: Provided you have infinite hardware resources. by gbjbaanb · · Score: 1

    experienced developers are just as quick with languages they are experienced in. Its not surprising to see a master craftsman bang out something complex with ease.Once you've reached a level of mastery, the time taken is really just down to typing speed - which is irrelevant.

    For junior developers, or those (like me who code C# by pressing '.' and seeing what intellisense clues I get next), then language does make a difference, but possibly that too is irrelevant as the time in developing is more about the overall environment and design practices than the actual coding.

  169. Re: Provided you have infinite hardware resources. by nasch · · Score: 1

    experienced developers are just as quick with languages they are experienced in.

    Just as quick as what? Some other language that they're also experienced with? I'm still not convinced of your (unsupported) claim just because you repeated it.

  170. Re: Provided you have infinite hardware resources. by gbjbaanb · · Score: 1

    as quick as someone else experienced and proficient in a language. The point is that one language is not "better" than another once you're good at it - a C++ dev is just as fast as a Java dev once they're good at their respective languages because they know what they're doing and can produce results very quickly.

    Take a while to think about it from the point of view of developer skill rather than language ease.

  171. Re: Provided you have infinite hardware resources. by nasch · · Score: 1

    a C++ dev is just as fast as a Java dev once they're good at their respective languages because they know what they're doing and can produce results very quickly.

    Well that's the third time you've claimed that without any supporting evidence, and I'm still not convinced.

    Take a while to think about it from the point of view of developer skill rather than language ease.

    This isn't a question that can be decided by thinking about it. The only way to tell if it's true is by measuring the output of developers in some way.

  172. Re: Provided you have infinite hardware resources. by gbjbaanb · · Score: 1

    Yep, and I'm not going to give any - its easy to demand evidence, troll-like, while offering nothing constructive to a discussion. so tghat's it from me. cya.

  173. Re: Provided you have infinite hardware resources. by nasch · · Score: 1

    Well I can't say I'm surprised by that response, and I think it's telling that you believe asking for evidence to back up a claim is "troll-like".