Follow

Having worked with a bunch of object-oriented programming languages, it's amazing how out-of-practice I am with C++ now. There's so many ways that it works differently from the languages that I'm used to that I wasn't fully prepared for.

I still eventually got a program to compile, though.

· · Web · 1 · 0 · 0

@swashberry I never coded in C++ because of such feedbacks.
don't know if it is a way to push people away from C++.

Is it really a life chasm compared to C?

Do you need all the features?

@charlie_root
Well I should stress that C++ is a perfectly fine language, and it still benefits from an efficiency that most modern languages don't.

The thing about C++ is that, since its introduction, programming language design and particularly object-oriented design has moved on, and some de facto standards have been put into place that aren't present in C++. C++11 did introduce a lot of the quality-of-life improvements of more modern languages, though.

@charlie_root
One of the things that makes C++ confusing is that it's basically C, but with a thin layer of something else on top of it, so it's easy to catch yourself doing things the C way when the C++ way would work better. It just takes a little getting used to.

@charlie_root
Having said that, I actually quite like C++ because it does a lot less hand-holding than a lot of modern languages. I can get away with certain things that many languages nowadays absolutely forbid, like declaring variables in the global scope if I need them. I tend to favor more old-school languages for this reason.

@swashberry interesting. Would you mean that sticking with C++11 would be an adequate "baseline" (retro-compat etc...)?

There's so much C++ projects that I would like to contribute too but I am afraid of the level of lang subset they use.

I want to be good enough with it, not mastering it (impossible) and too dependent of new specs.

put it that way, is it difficult to follow whan the lang evolves?

@charlie_root
I'm not finding it too difficult to follow. Most people these days seem to treat C++11 as the standard, which is a little annoying if you're using G++ since G++ favors C++98, but C++11 is definitely the easier standard to use.

I don't actually know about retro compatibility. I'm intentionally avoiding using C++11 because I want to see if I can get my current project to run on DOSBox, but I'm a crazy person.

@charlie_root
If you're not sure what language standard a project is using an easy way to tell is to look at how they do string manipulation. C++11 introduced the `to_string` function, which is used to convert a numerical value to a string so it can easily be appended to another string. C++98 instead uses a class called a `stringstream` to append values to a stream which can then spit out the resulting string.

Sign in to participate in the conversation
Linux.Pizza

A instance dedicated - but not limited - to people with an interest in the GNU+Linux ecosystem and/or general tech. Sysadmins to enthusiasts, creators to movielovers - Welcome!