Live data from Hacker News

C++20, How Hard Could It Be

docs.google.com

281–290 of 444 posts

Re: C++20, How Hard Could It Be

#281

Very useful presentation. Full of details, but easy to consume. On voices against stripped down C++ (via code style): I find it working great in practice. Makes the codebase manageable, and keeps people away from using unnecessary complex language features (imagine Java code heavy with streams or reflection, or Python code that resolves most of dependencies at runtime, javascript full of eval(), etc.). Switching to a…

Ad-hoc black or white bans are very retrograde and costly for tje most part and usually stem from purity thinking. Case in point reflection in Java is a godsend. I use it very rarely because it'd uses only comes for very specific needs but when I use it, the alternative either doed not exist or usually would be much more uglier. As for streams well it's just regular functors (map, filter) they are used in every langu…

I agree with this comment, and cannot understand why is downvoted. I would like the one that downvoted comments on why. My thinking, more or less in line with the comment is: instead of investing energy, time and resources in writing laws of what is allowed and what no (often without rationale). Use that time, effort and energy in educating developers, so that, if those prohibitions are really sensible, they will anyway refrain from doing that. You get the benefit of not having to change the bans. By doing regular code reviews, you can detect ill formed code, and discuss with the developers. Maybe some developer has something to teach to the "big experts" who write those documents?

Re: C++20, How Hard Could It Be

#282
Honest question, do not want to insult anybody: I've heard lots of times, that the reason why C++ sometimes is weird and complex, is because utter care is taking in maintaining backward compatibility. Sorry if I'm wrong, but I remember seeing a video about variable initialization, which showed many ways of initializing variables, and at the end, the excuse was "all because we have to maintain compatibility to C". No my question, again, please do not think I'm insulting anybody: This presentation seems to show the compatibility between most recent releases is not very good. What am I missing here?

Re: C++20, How Hard Could It Be

#283

Earlier quoted context omitted.

> Programs are written first and foremost to be read by other humans extremely bold assumption. plenty of write-only or use-once code in the wild.

I think if write-only code were the norm, then APL would be more popular.

But there are APL, k, j and other array lang programs. You can't do as if those don't exist when talking about programming as a whole. Perl used to be pretty popular too.

Re: C++20, How Hard Could It Be

#284
post #254

Earlier quoted context omitted.

If there's ever a big production outage, you can make the case for Java.

Because Java is known to magically never cause production outages?

Because the OP described inheriting a C++ app his team doesn't know how to manage.

It's a language where segfaults, memory leaks, and other problematic issues are easy to manifest.

I assume they have deep Java knowledge, since they suggested it themselves.

Re: C++20, How Hard Could It Be

#285
post #172
post #64

Earlier quoted context omitted.

GCC has gotten better indeed, but it's still in a different league than Clang. I still get into situations where I can't make heads-or-tails of what GCC is saying to me, which can usually be easily solved by switching to Clang.

One problem here is that GCC emits certain warnings as part of the optimizer, which results in many false positives that are essentially impossible for the lay programmer to understand. For example, jump threading might duplicate some code path and propagate constants in it, and then warn about an uninitialized variable / out of range access / etc in that code-path, even though it does not exist in that form in the o…

Funny enough, this is exactly the kind of situation where other people cry "why did the compiler not warn me about basing optimizations on UB".

Re: C++20, How Hard Could It Be

#286

Very useful presentation. Full of details, but easy to consume. On voices against stripped down C++ (via code style): I find it working great in practice. Makes the codebase manageable, and keeps people away from using unnecessary complex language features (imagine Java code heavy with streams or reflection, or Python code that resolves most of dependencies at runtime, javascript full of eval(), etc.). Switching to a…

Ad-hoc black or white bans are very retrograde and costly for tje most part and usually stem from purity thinking. Case in point reflection in Java is a godsend. I use it very rarely because it'd uses only comes for very specific needs but when I use it, the alternative either doed not exist or usually would be much more uglier. As for streams well it's just regular functors (map, filter) they are used in every langu…

"no exceptions" is one of the best parts of Google style guide, IMO. Note that, banning of exceptions introduced returning status (error codes done right). It makes it easier to follow the code and makes the code more readable (but, you need a few macros, unfortunately).

Re: C++20, How Hard Could It Be

#287
post #247

Earlier quoted context omitted.

`std::this_thread::yield` already existed at the time, and “yield” was presumed to also be a common identifier in financial and agricultural contexts. I’m nevertheless surprised that new noncontextual and previously-unreserved-identifier keywords were added at all. In earlier times, the approach would have been to use a reserved identifier like “_Yield” for the keyword, and to provide a standard opt-in header that wo…

I’m not sure C++ has ever used the `_Yield` hack, except for C compatibility? C on the other hand uses it all the time.

It could be that I'm remembering it from C.

Re: C++20, How Hard Could It Be

#288
post #278
post #267

Earlier quoted context omitted.

TBH I was shocked by "Python for machine learning". I do not know where that comes from. Maybe because some important toolkits are available for Neural Networks? But machine learning is not neural networks... you can do it with NNs, but there are so many other algorithms... I'm really surprise of this kind of posts in hacker news. I thought the audience here has other experiences.

That's literally the only one that didn't shock me. What universe do you live in where machine learning algorithms aren't tied together with Python? And what industry where machine learning is not mainly neural networks?

In the company I work most of it is done in matlab for "putting together" then goes to C++. Again not neural networks. I'm saying all the other machine learning. Maybe rare case.

Re: C++20, How Hard Could It Be

#289
post #267
post #212

Earlier quoted context omitted.

>Java for enterprise or Android >C# if you are windows developer Picking Java over kotlin for android, or lumping C# into "just for windows" bucket is exactly the ignorance that leads you to "we don't have choices" conclusion. If you always default to literally top1 language for given domain, then how can you expect to have multiple choices? I'm not talking about using some brand new gimmick that came out yesterday a…

TBH I was shocked by "Python for machine learning". I do not know where that comes from. Maybe because some important toolkits are available for Neural Networks? But machine learning is not neural networks... you can do it with NNs, but there are so many other algorithms... I'm really surprise of this kind of posts in hacker news. I thought the audience here has other experiences.

Python for machine learning is a coincidence of history.

Python is the traditional scripting language for high-performance computing (HPC) going back a very long time, as a wrapper for highly optimized and scalable C libraries. Python on supercomputers wasn't originally used for machine learning but it naturally included support for excellent linear algebra libraries, etc for various types of large-scale modeling. When machine learning first became trendy, data scientists that wanted access to mature library implementations of critical algorithms that worked very well at large scales were mostly limited to C/C++ or Python wrappers of that C/C++. Naturally, they chose Python for the same reason Python was already being used in HPC -- ease of use.

By virtue of its use in supercomputing, Python had uniquely strong support for many types of machine learning before there was a demand for machine learning. If HPC had used some other popular scripting language instead of Python, we'd probably be using that for machine learning right now.

Re: C++20, How Hard Could It Be

#290
post #281

Earlier quoted context omitted.

Ad-hoc black or white bans are very retrograde and costly for tje most part and usually stem from purity thinking. Case in point reflection in Java is a godsend. I use it very rarely because it'd uses only comes for very specific needs but when I use it, the alternative either doed not exist or usually would be much more uglier. As for streams well it's just regular functors (map, filter) they are used in every langu…

I agree with this comment, and cannot understand why is downvoted. I would like the one that downvoted comments on why. My thinking, more or less in line with the comment is: instead of investing energy, time and resources in writing laws of what is allowed and what no (often without rationale). Use that time, effort and energy in educating developers, so that, if those prohibitions are really sensible, they will any…

What's easier: writing set of rules to drop language features or educating 10k engineers? It's difficult alone to have those engineers follow the style guide (even with help from linters etc).

Average engineer, in any company, doesn't care about the language they use. Just wants to get stuff done. And that's how it should be.

Post reply on HN