Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
You won't find another language that's 10 times as fast as c# and has type generics. C++ can be beautiful and efficient, or complicated and barely running. It takes a lot of planning to make it right.
-
LLAMS37486yIt was invented because Bjarne Stroustrup wanted to program in Simula but was made to program in C. So he made a preprocessor for C to make it look like Simula. Hence C++ was born. Basically someone hated C and wanted something better. Incidentally this is also how Objective-C was born, except we ended with something worse instead of better.
Little history for ya 😎 -
lxmcf204106yHave a gander at C, I hate C++ too and after like 5 minutes of messing with C... I know where my allegiance is
-
C++ is four languages in one.
1. C with extensions (type safety, overloads)
2. Classes
3. Templates
4. Extension frameworks like Boost.
Start with the first and go to the next level only once you have mastered the previous.
With C you have great power, but can shoot yourself in the foot.
With C++ you have even greater power, but can shoot yourself your leg off. -
You say that but then you realize there's OOP (Classes with inheritance, functions with overloading), generics, static compilation, a very complete standard library, proprocessors, operator overloading, c-style AND object-style strings, pointers AND references and you realize that c++ is actually just a really powerful tool.
Don't worry. People tend to cut themselves a lot until they get used to it. The << overloading trend is a little odd though. It's weird to cout << "Something" instead of print with a function but whatever. I forgive it. -
@Lor-inc I don't know specifically about parsing ints from strings but I know there's std::to_string
-
@Yamakuzure Sounds pretty familiar.
I have a lot of expirence with PHP and go, from these two c++ is a lot more low level and sometimes feels really bloated.
@AlgoRythm we're not allowed to use a lot of things from the standard library...
But I admit it, generics are cool. -
Also why do you get a segfault when trying to access a value in an array which is greater or lower than the array, but not when moving an item in the array to a position of (length of array)+1 ??
Had a lot of fun with this one yesterday. -
@irene With SStream you can convert a lot of formats.
Example : https://geeksforgeeks.org/convertin... -
@irene no, you aren't. There are some cases in which the StringStream class is convenient, but efficiency looks different. If it needs to be fast, that extra layer won't help, and using atoi() and friends directly is the better idea by far.
-
TafT266yJust wait for when you.get stuck on a micro or tool chain without dynamic allocation, exceptions, strings or some other fun obsticle. 16 MB is still a vast amount of memory in some places 😁
-
TafT266y@Yamakuzure OOD != Dynamic allocation || (STL || std lib)
Once you are very use to C++ and object oriented design there are lots of problems simpler to solve with it than with C and procedural programming. No virtual classes also helps remove the main memory overhead that C++ should have over C.
It is a weird old world in odd micros and old specialised tool chains. Now days you are much more likely to have full standards support and bags of memory on an ARM or similar. There are times you still might be counting the IPS let alone the MIPS.
Related Rants
-
xjose97x19Just saw a variable in C named like this: long time_ago; //in a galaxy far away I laughed no stop.
-
Unskipp24So this happened last night... Gf: my favorite bra is not fitting me anymore Me: get a new one ? Gf: but it ...
-
sam966911Hats off to this lady .... I would have just flipped the machine
After two days if uni related c++ programming, all I can say is one thing:
FUCK YOU C++
rant
why was this language invented
c++