Is C++ just a meme?
It seems that every kek I know of who wants to learn to program thinks
>"gonna learn c++ is cool xD"
Out of experience, is there anything that C++ excels which another language does not do better?
Is C++ just a meme?
Is C++ just a meme?
It gives you more power than just about any imperative language.
With #DEFINEs, overloading, and other bullshit, you can practically write your own language with it.
No garbage collection and no unboxing means you can bitfiddle data structures at the low level as well as build great castles of abstraction and decide exactly what resides where in memory at all times.
So it is unique in that it has a foot in two worlds of low level and high level and refuses to give up any power for safety. With great power comes great responsibility.
Yeah C++ is awful that is why pretty much every single video game and operating system is written in C++
It's great if you've got the manpower to develop for it, because it's just a huge timesink to make anything decent with it.
As a solo developer you're better off with a higher level language if you actually want to make something and have it work.
Linux is written in C.
I meant desktop operating system.
It's better for just about every application except web dev.
Even than if you've got some guru C++ guy doing some backend engineering it's going to shit all over something a pajeet's done up in some other language like python or perl.
GNU/Linux is written in C
I like this.
I meant desktop operating system.
>linux isn't a desktop OS
Well meme'd pajeet
Not that guy, but:
GNU/Linux COULD very easily have been written in C++ using the STYLE of C, that is, "C with Classes", which is personally, my favorite approach to the language.
Compile as C++, so you can add whatever you need, SHOULD you need it, but keep it lightweight when it's not necessary or when it'd be unreasonable to use the extra features due to performance hits at the low level.
I meant good desktop operating system.
>which is personally, my favorite approach to the language.
You're a retard then.
If you're going to use C++ in the first place, you should write idiomatic C++, that is embrace RAII, embrace the STL, embrace const correctness, embrace smart pointers, embrace constexprs and type inference etc.
C++11 and newer is truly a high level language. Either write C or C++, not limit yourself by writing C++ as if it is "C with classes".
C++ is the most powerful language that exists
It's not the most stable, the most secure, the easiest, the most elegant or the most lightweight, but for making fast, heavy duty desktop applications in a reasonable amount of time, C++ is king
C++ isn't better at one particular thing than other languages, but being quite good in almost every single area is what makes C++ so powerful
S A V A G E
"To be good cpp programmer you need to be masochist"
That what my professor of object oriented programming said.
More i think about that, i see it is true. Writing good cpp code is painful and slow process
I know the "pajeet" thing is satire and all, but it stopped being funny a while ago. Now it's just racist. You can stop already.
you heard him
you are all fucking white males and when non white says that something is racist then it means that it is racist
C++ can do literally anything, which is what trips people up. It's the most powerful programming language there is, but it won't hold your hand.
what are you smoking?
win, osx, linux kernel are written in C.
>memes can be stopped
The meme is telling people to do not learn C++.
Seriously, if you don't know C++ you are really limited in terms of what you can do.
Graphics programming, C++
High Performance Server software, C++
High Performance Anything, C++
You need to make your code run in everything, C++ (Fuck Java, C++ compiles to everything, from satellites to traffic lights)
Retards that don't know C++ scare you to death telling you to do not learn C++,
Need to develop even even faster? White clojureScript that calls js C++ functions to it (this is actually what I'm doing right now, it works quite well)
Let's play: Spot the Pajeet... And I think that I already saw him...
Retards be like:
>Pointers will bite me in the ass...
>I can't understand what * or & means...
then : C++ It's shit...
I've learned C++ for three years.. I'm still learning new things every day... It's a relatively complex language with a lot of things that gives you a lot of power... people that say is old and ugly or whatever doesn't know shit about programming...
Yes but does it pay to learn C before or after C++?
OP just can't into C++
>"Now it's just racist."
>caring about some poos who can't read these posts anyway
It's one of many team-oriented languages. Not everyone is comfortable with that.
Ada is better than C++ in almost every way.
If you replace "Ada" with "Object Pascal", you won't need the word "almost" anymore.
I think it's time to leave Pascal in the past
Says who ? Object Pascal is god-tier.
Any suggestions on learning idiomatic c plus plus?
In the real working world you really have no choice no matter how shit you perceive the language to be. You are not going to rewrite a few hundred millions LOC just because python is hip. The reasons why people hate on C++:
>template metamagic programming makes compile errors difficult to read and understand
>if you don't know what you are doing you are going to pass by value and create 3 million copies
>the standard library doesn't hold your hand and will allow you to read and write memory out of bounds
>header and body separation
>retarded unicode string handling
Well probably more here.
It's a bloated pile of shit.
What C++ book would Cred Forums suggest? C++ primer?
Is it worth to learn C first and then move to C++ or it does not matter?
>YOU'RE A FUCKING WHITE MALE
Shouldn't you be out with your trannie condemning the GNU?
I'd start with Bjarne's Programming even if you are an experienced programmer in other languages. Then move on the effective C++ and primer. For further studies there are more information on stackoverflow about recommended C++ books.
How simple is it to import from the c stdlib in object Pascal?
>integers have to be declared as a user-defined type
Guys, what's the best way to use C++ on windows? Should I get GCC from mingw distro, cygwin? Or maybe go with msvc?
GCC is deprecated. Use clang.
Why would you want to do that ?.
Yeah as this user said use clang. If you want no effort to setup just install msvc.
If you wanna use pthreads, see
If you wanna use your own C libraries, see
Anything else can be handled by the RTL, see
The official reason is to easily interface with modules written in other languages, but you can also use it to write near identical binaries to a c program.
C++ is java but with more power and complications.
Low Latency dev here. I can confirm C++ is p. much the alpha and omega in high performance systems and that binding is essentially the bifurcation point between useful devs and eventual burnouts who /not going to make it/ and will eventually come and troll about C++.
I definitely don't recommend it as anyone's first exposure to programming. There's too much damage too easily done. Pick up C or Java first and then transition to C++ or C# then C++.
Finally, I can't leave without saying that, at least in my industry, the standard development platforms are all Windows. I use Linux at home, but I say that because newfags who don't want to give up muh gaymen shouldn't feel bad about learning to program without switching over.
If anyone here is new and wants some help I'll try to answer some questions before I log and head home for the weekend. I have a spare hour before our Friday debrief.
In my industry people write in C++ or they write in python.
Python is fast to write, C++ is faster to run.
A lot of tasks does not require speed, so they go for python, other things are more practical to do with C++.
The only problem I have with the language is when people add too many abstractions to things that shouldn't be complicated.
Take compiling the code:
Makefiles makes it easy to compile multiple files in a project and link them together.
Cmake is an abstraction so it is easier to generate the make files.
But why would you make abstractions to cmake as well?
Fucking hell, just make standards and improve upon the tools we have so we can move on and do some real programming.
Your suggestions on learning C and C sharp?
Show me another language where
I'm headed out the door now, but I suggest picking up Head First C to start with, and complete it before you transition into C# for more abstraction. Going from C to C# basically gives you the under and over on C++, so when you settled down to C++ after becoming familiar with the two you know more or less what it's capable of already and just have to wrap your head around the syntax.
Not him but I work in traditional industry (rolling stock, automation, robotics, automotive etc) and defence industry. Everything is most likely C++ or something that compiles to C. If it's some really old legacy stuff you may have to code in fortran77. Otherwise it seems like everything is C++ for crossplatform support for backend with traditionally Java for frontend shit. Now Java is being replaced with C# and windows machines for frontend stuff.
I'd say knowing C++ and C# will take you far if you aren't interested in web.
>This new element is constructed in place using args as the arguments for its construction.
Basically, it inherits the constructor of the class it stores.
Are you talking about the move constructor and the && that makes shit an xvalue or rvalue or what the fuck ever.
I'm seeing a lot more C# myself. I wouldn't say Java is being phased out per se, but there is definitely a lot more interest in C# frontside. In my neck of the woods the bottom balls is all C and a little C++. I'm in distributed systems engy.
I have yet to find anyone in the industry that actually enjoys coding in Java. I guess because coding in C# is fast and a nice experience is part of the reason we are moving away from Java. And the ability to easily import C++ dlls allows companies to avoid various publisher/subscriber patterns and rpc schemes helps with adopting C#. Plus you can easily make modern looking guis quickly in C#.
It's called variadic templates. D should support them.
If you're going to write in C, then do it in C. Don't treat C++ as "C with classes".
I heard somewhere that pointers don't work well with optimizers.
Is this true? How much does it affect performance?
hes talking about how it uses placement new to construct it in place.
no move, no copy.
I'm not even sure what is trying to be demonstrated here. Normal allocators in C++? As far I know they construct stuff in place.
Emplace will if there is an element at position shift all objects from position to the right (should be extra memory allocated for the underlying array) and construct a new element at position and move the arguments into the new object.
It will construct an element in place by using class's constructor, without constructing class first in any way. Other elements will be shifted.
Agreed. Nobody particularly likes Java and MS has done a very good job lately of bringing C# to a competitive position. I don't do a lot of fronty work but those who do are fast becoming MS fanbois, which is really weird considering we were and still are mostly linux snobs.
It's indispensable at the moment since it's the only compiled non-GC language with an adequate set of libraries and enough linguistic feature flexibility.
That said, it made a lot of fucking mistakes along the way and has only fixed a fraction of them as it's slowly morphed from C++98 to C++14.
> still no Concepts = enjoy solving your template instantiation bug
> still no Modules = enjoy waiting forever for re/building
> still no unified call syntax = chained operations still a nested parentheses mess
> exceptions = shit compared to returning type unions/tuples
> RAII single-exception limit semantics = complex/chained error handling is infeasible
> 'this' is a pointer instead of a reference = fuck you Bjorky
> library ABIs - good luck maintaining them (bonus: fuck your non-standardized name mangling)
isn't the whole unified call syntax thing going to be fixed in c++17?
v.push_back(bigobject(args...)); // creates bigobject, then copies/moves into the vector
v.emplace_back(args...); // creates bigobject in vector
>It will construct an element in place by using class's constructor
So it basically figures out which constructor to call from the argument list? It's actually a display of variadic templates now standardized in C++11?
like every other attempt at fixing the language, it got dropped because reasons
Yeah it's weird. Everything was linux and know diehard linux fans propose to move frontend stuff to windows and C#. Whatever MS is doing it's working.
It's still my favorite language, but man, that was a misstep.
rust went in a good direction,
but i think it tries to hard to be a special snowflake language.
Never mind I got it. Object is created in place in the array with matching constructor. No move or anything is going on.
How does the move constructor actually work? I thought it worked in a similar way.
Rust isn't very special
REEEEE proprietary REEEE
Satoshi Nakamoto chose, C++, therefore so shall I.
The primary mistake of Rust (besides SJW faggotry) is that it doesn't take any less intellect (just less effort, which is not the same thing) to navigate their explicit lifetime semantics than to manage object lifetimes safely in C++.
I.e., it'll never be pajeet-tier enough to grow its userbase, and the best they can hope to manage is to steal over a few bored or fanatic C++ devs.
As a fanatic c++ dev, I really hate rust.
because of the language itself, its current implementation and library, or the people?
Add in nih and no standard and you have a full house
The reason that C++ remains popular is because C is the defacto systems language and so C++'s backwards compatibility with C means it will always work. The style OO that C++ introduced is pretty much the standard that all programming languages fallow, Java syntax for example is pretty much an exact duplicate of C++. The fact that C++ doesnt use gc makes it a good benchmark language to compare with modern gc languages. But the fact that C++ has to stay compatible with C means much of its core syntax has to be implemented with templates. Anyone who says that template programming is modern is full of shit and basically trying to save their C++ job from being replaced with modern compiled gc languages like Rust, Go, Swift, etc which can run at pretty much the same speed as C++ and dont require special rules and idioms to control memory. Pretty much every programming thread about modern programming languages is spammed by C++ shills trying to call everything new a meme.
The language, its implementation and library, its people, its syntax, the programming practices it encourages, its features...
>thee programming practices it encourages
Theres a book called Modern c++
Wt is pretty great for web dev
read the Amazon reviews for this book, its hilarious, basically the whole book is 'stupid tricks that you can do with templates that no one would ever have user for'
The fact that you think c++ style of oop is the same as Javas style of oop shows how much you don't know about c++
Templates are great for compile time optimizations/testing making much better runtime code.
Also where are you getting these benchmarks?
C++ performs as well as C, but allows for greater levels of abstraction through OOP, template metaprogramming, etc... It uses RAII for resource management, which is a lot better than manual malloc/free in many cases, but still deterministic, unlike a garbage collector. It also can be used for managing resources other than memory, which garbage collectors kinda suck dick at.
To compare it to other languages:
1. It is better than C where program complexity is high, and one doesn't need to use the C ABI for literally everything.
2. It is better than Rust where compatibility with C libraries is desired, or a more mature language is needed (Rust is not exactly as fast as it could be, for example).
3. It is better than everything else in terms of performance... except for maybe Fortran. But for most tasks where C++ is used, Fortran would be rather inappropriate.
The scott meyer book, effective modern sepples
And the Discovering Modern C++ by Peter Gottschling?
>The fact that you think c++ style of oop is the same as Javas style of oop shows how much you don't know about c++
sorry, Im not impressed by your vague hand waving about C++'s advanced OO features
>Templates are great for compile time optimizations/testing making much better runtime code.
this is bull, anyone whos ever worked on a large complex C++ with lots of template programming can tell you this is bull
>Also where are you getting these benchmarks?
Theyre all over the internet, try a web search
C++ is a weird middle-space between high and low level language. Although technically a "high level" language, you can involve yourself with just about anything you'd like to at the low level. If some low level thing is either impossible or cumbersome to do with C++, assembly is readily employable via C++ as well.
It's a powerful and unique language that some people tend to dislike because it's difficult and defies the preferences of some purists due to it's versatility and utility.
thats disappointing, seems like it would be a pretty good change.
Doesn't beat assembly with regards to performance.
Hah, thought you were all smart and high and mighty there. Just took you with your pants down, baka.
Nobody actually uses c++ anymore. They use a bunch of wrappers. They only need c++ programmers to glue the high level stuff together.
For one not everything is an object in sepples, you can do oop with data oriented design, oop by composition, oop by inheritance(which is the terrible way that Java does oop)
Templates are ugly but powerful while keeping c++ compatible with C. They're not that difficult with large scale projects when you keep shit modular. They can help optimise by doing specific calculations during compile time instead of recalculating during runtime, and can help when building platform dependant code.
If example benchmarks are all over the internet then grab one, then grab one that you know of to be a legitimate example. You know as well as I do that blogs with sterilized benchmarks don't represent real world senarios where memory, latency, and speed actually matter.
No they don't. Everything you said in your post was wrong.
>when you drop a dank meme to ignore your joke language being BTFO
it's not racist if it's true
>When you don't know what you're talking about but want an answer so you reply with more memes
It's defined in the standard package FYI
Nah, he's right. I don't like MS or C# either, but it is picking up steam right now. Probably just bribery from MS in my industry, but it is happening.
Actually, modern optimizing compilers can often beat out hand-written assembly in terms of performance. Most people suck at writing assembly.
How retarded do you have to be to try to virtue signal on an anonymous message board?
If you find yourself in a position to reinvent a wheel, its one of the easiest languages to do so with. Idk which other languages have pointers like C++ but it allows you to do some pretty amazing things and efficiently.
Binding the cpp in python
Am i a retard for doing this the other way? (Call my python in the cpp)
Visual studio, mingw, whatever
Stop shilling. I have worked for big 10 companies in both SF and NY. Nobody uses fucking C# front end unless they are literally MS owned. Java is still the order of the day. Debate which of the two sucks more, but you cannot deny that.
This is true.