Live data from Hacker News

I learnt C++ in 2018 and have no regrets

vishnubharathi.codes

231–240 of 259 posts

Re: I learnt C++ in 2018 and have no regrets

#231
post #74

Earlier quoted context omitted.

C compatibility was the very reason for which C++ is bigger, more complicated and less safe than a similar language not compatible with C could be.

Objective C and D both have excellent C compatibility. C# has very good one. I think all 3 languages are easier to use.

They all may have excellent C compatibility, but this is not the point. The point is that without C compatibility C++ could be smaller and simpler, and yet still meeting the same goals and covering the same use cases. Objective C has Smalltalkish object system glued to C base. Fundamental C++ techniques like RAII not possible there. D has GC. C# runs in a VM. I would not call a language with any of those features very similar to C++.

OTOH if not for C compatibility we would not have this discussion, since we would most likely never heard of C++.

Re: I learnt C++ in 2018 and have no regrets

#232
post #115
post #74

Earlier quoted context omitted.

C compatibility was the very reason for which C++ is bigger, more complicated and less safe than a similar language not compatible with C could be.

Really? C++ accidentally has a Turing complete templating layer. I suppose one could point to Common Lisp but if you think that is simple....

I never said that this language would be simple. Just simpler than C++ we know.

Re: I learnt C++ in 2018 and have no regrets

#233

I've learned 15+ years ago, and I stopped paying attention around ~2010, which is just before significant changes were made. Even though I read up on some features and concepts from C++11 and C++14, I feel so disconnected from what's going on as if what I learned was a completely different language. Can anyone recommend any source for someone with lots of pre-C++11 experience to get up to speed with current capabilit…

> I've learned 15+ years ago, and I stopped paying attention around ~2010, which is just before significant changes were made.

Which probably means that someone who learned modern C++ will have significant difficulty with older C++.

Sometimes it makes me wonder if someone should just declare a subset of C++ as "good" and call it a new language.

Re: I learnt C++ in 2018 and have no regrets

#234
post #204

Earlier quoted context omitted.

> work nicely with win32 is probably less effort Gonna be very hard to do. For the last 15+ years COM is essential part of WinAPI, and too many things in Rust conflict with COM: ownership, OOP, virtual tables, inheritance, they all too different. Not just in Rust, in all languages, actually. You only have 2 good choices for complex platform-dependent windows development: either C++, or a microsoft's language with COM…

Delphi, JavaScript, Python and C++ Builder as well.

I think Delphi and C++ Builder were only good enough while WinAPI meant “C API”.

JavaScript is OK for platform-independent development with electron. For platform-specific i.e. WinRT not that good, .NET is just better, and MS put the JS libraries in maintenance mode: https://github.com/winjs/winjs

Python was never good. I’ve tried using winapi through C interop a few times, didn’t like it at all despite what I did wasn’t even too complex.

Re: I learnt C++ in 2018 and have no regrets

#235

Earlier quoted context omitted.

There's nothing really fundamental to the changes in C++11 and beyond: There are lots of little tweaks, as well as some deprecations and outright removals. However, there's the prevailing sense in the community that the many tweaks together genuinely change the flavour of the language, at least from the perspective of traditional C++ development. The combination of "auto" (plus template type inference), ranged for-lo…

Wow, thanks for the detailed description! I guess I'll have to think a bit about each new feature from C++11, 14 and 17, and then Google some more, to understand the full implications.

Do let us know if you find any kind of "summary for old C++ devs". I agree that such a document would be super useful.

Re: I learnt C++ in 2018 and have no regrets

#236
post #185
post #97

Earlier quoted context omitted.

Well, it is. Every f*up you can have in C, you can also have in C++.

Only if you write unidiomatic ( Read crap) C++. In modern C++ it is very much possible to write fast and safe code, but the tradeoff is now put into the amount of stuff the developer needs to know to be productive (Which in my experience isn't as bad as people like to go on about on here/reddit, even if it still pretty shoddy)

> Only if you write unidiomatic (Read crap) C++.

Thats a bit unfair. A recent headache for my C++ project was mixing audio buffers. The buffers are cached to avoid repeated reads, the channel count differs, the sample rate can differ, the output rate can differ, and mixing has gain limiters applied etc. Lots of buffers, lots of copying, lots of boundary cases (eg. sample #1 doesnt start until t=100ms, sample #2 ends before sample #1, etc).

I struggled for days getting all the buffer copying right (raw pointers to many interrim buffers). You may think that my problems were due to using "crap c++ in unidiomatic way". However, I challenge you to find a better, and as efficient method to accomplish the same goal. The end MixAudio() function looks like plain old C code from the early 80's, but how else can you tackle this problem in a modern way?

Re: I learnt C++ in 2018 and have no regrets

#237

Earlier quoted context omitted.

I ran into this trying to get into it about 3 weeks ago. I'm so used to things like npm, ruby gems, go packages, pip that it felt like a huge task just to get something built or settle on a way for me to build mine. Even grabbing libraries from github, I was unsure if I should grab just the headers and DLLs, or import the entire tree and mashup my build scripts with theirs. I wish I had stayed with it since college b…

> Even grabbing libraries from github, I was unsure if I should grab just the headers and DLLs, or import the entire tree and mashup my build scripts with theirs. Honestly this is something that apt (et al.) make so easy on Linux distros that when you move to Mac or Windows you just have hard time believing people still in 2018 have to _deal with this shit_ (installing libraries and their headers by downloading each…

How is this problem fixed on Linux?

Headers/libraries on an Ubuntu LTS may be years out-of-date.

Am I supposed to just download a tar.gz and do the configure/make/make install dance to /usr/local or /opt or something for each dependency that I need a more current version of?

Even worse - what if my deployment target is 3-4 years older than the machine I'm developing/compiling on?

I don't think anything is "solved" with a traditional UNIX environment. Not even close.

Re: I learnt C++ in 2018 and have no regrets

#238

Earlier quoted context omitted.

> Even grabbing libraries from github, I was unsure if I should grab just the headers and DLLs, or import the entire tree and mashup my build scripts with theirs. Honestly this is something that apt (et al.) make so easy on Linux distros that when you move to Mac or Windows you just have hard time believing people still in 2018 have to _deal with this shit_ (installing libraries and their headers by downloading each…

How is this problem fixed on Linux? Headers/libraries on an Ubuntu LTS may be years out-of-date. Am I supposed to just download a tar.gz and do the configure/make/make install dance to /usr/local or /opt or something for each dependency that I need a more current version of? Even worse - what if my deployment target is 3-4 years older than the machine I'm developing/compiling on? I don't think anything is "solved" wi…

> Am I supposed to just download a tar.gz and do the configure/make/make install dance to /usr/local or /opt or something for each dependency that I need a more current version of?

No, you're (usually)supposed to stick with the out of date version rather than the shiny new version. Doing otherwise is taking on the responsibilities of a distro maintainer, usually not consciously.

> Even worse - what if my deployment target is 3-4 years older than the machine I'm developing/compiling on?

Either use the older version for developing or at least have a version of that environment for CI.

Re: I learnt C++ in 2018 and have no regrets

#239
post #167

I studied C++ during university days and after that I never got a chance to learn it seriously due to my job commitments as a web developer. I did work on C# but not C++ professionally. I always admired my friends who could write good C or C++ code. So many times I wish to learn it seriously but these new editors for web development and Python made me lazy enough that I wish to have some environment and way to write…

I have spent my whole career writing C or C++. While it is true that I write code at a different layer of the stack than is common for languages like C#, I wouldn't say it is particularly admirable. There are intermittent cool things that I get to write in C (data structures, protocol stacks, etc.), but for the most part it is just plumbing. There are lots of cool things that people get to implement higher up the sta…

Will you recommend some source? I mostly have a Web Developer and Python background

Re: I learnt C++ in 2018 and have no regrets

#240
post #204

Earlier quoted context omitted.

Delphi, JavaScript, Python and C++ Builder as well.

I think Delphi and C++ Builder were only good enough while WinAPI meant “C API”. JavaScript is OK for platform-independent development with electron. For platform-specific i.e. WinRT not that good, .NET is just better, and MS put the JS libraries in maintenance mode: https://github.com/winjs/winjs Python was never good. I’ve tried using winapi through C interop a few times, didn’t like it at all despite what I did wa…

Delphi and C++ Builder have first class support for COM and UWP. In fact, both had better COM support before VB migrated from VBX to COM with VB 6.0.

JavaScript has first class support on UWP. Of course WinJS is in maintenance BB mode. The future of JavaScript on UWP are PWA apps, with direct access to UWP APIs, no more need for WinJS, which was a Windows 8 library.

Python has supported COM with help from PyWin32 since ages. Hardly any different from VBScript.

Post reply on HN