C++ is bloated

>C++ is bloated
>C is better because simpler
>C is faster

Attached: Screenshot_20180729_215524.png (1136x414, 76K)

Other urls found in this thread:

en.m.wikipedia.org/wiki/Sort_(C++)?wprov=sfla1
youtu.be/D7Sd8A6_fYU
researchgate.net/publication/285576045_Five_Popular_Myths_about_C
v.firebog.net/hosts/Airelle-trc.txt
twitter.com/SFWRedditVideos

It's a known fact that C++ is fast af senpai

The problem with C++ is that no one has a fucking idea how to use it. Programmers don't even know why chose for C++ in the first place. Most of the times they just think that the "++" somehow makes it better and they end up writing procedural code using none of the C++ features.

Also it has the same problem Perl has: if you ask 10 people to write FizzBuzz, you get 11 different solutions.

>He hasn’t wrapped his own libc since kindergarten

>no one has a fucking idea how to use it.
i disagree. I've seen some people who know how to use it, although I've also seen people who write absolutly garbage C++ (me when I was in uni)

well yeah, but Jow Forums insists it's not as fast as C.

Who cares what language is faster? C is better nonetheless

>Who cares what language is faster?
t. exclusively writes fizzbuzz

It's slower if you use C++ for the one reason you'd use it over C: OOP

Why write more? You don't need more as a PoC

>hurr qsort is the same algoritm as sort
The C++ standard requires that a call tosortperformsO(NlogN)comparisons when applied to a range ofNelements.In previous versions of C++, such asC++03, only average complexity was required to beO(NlogN).This was to allow the use of algorithms like (median-of-3)quicksort, which are fast in the average case, indeed significantly faster than other algorithms likeheap sortwith optimal worst-case complexity, and where the worst-case quadratic complexity rarely occurs.The introduction ofhybrid algorithmssuch asintrosortallowed both fast average performance and optimal worst-case performance, and thus the complexity requirements were tightened in later standards.
en.m.wikipedia.org/wiki/Sort_(C++)?wprov=sfla1

Attached: CebPFyx_d.jpg (640x665, 20K)

C++ only exists to create jobs for the committee. The only people who fully understand C++ are the people who work ON the language, not WITH the language. And those people are of course available for training and consulting! When other people start feeling like they might actually understand the language, the committee changes it.

you do know that C++ is extremly popular language in commercial software, right? it is also almost exclusively used in scientific computing.
you don't have to understand the language 100% to write good code with it, and take advantage of all it's features (runtime polymorphisme, templates, lamdas...) to make your life easier.

>66937711
Aside from sort, the C++ standard library also includes the qsort function from the C standard library. Compared to qsort, the templated sort is more type-safe since it does not require access to data items through unsafe void pointers, as qsort does. Also, qsort accesses the comparison function using a function pointer, necessitating large numbers of repeated function calls, whereas in sort, comparison functions may be inlined into the custom object code generated for a template instantiation. In practice, C++ code using sort is often considerably faster at sorting simple data like integers than equivalent C code using qsort.[10]

>that no one has a fucking idea how to use it
Let me give you a tip. Don't worry about "am I doing this right?" as long as you make it work. You will never do it the right way from the beginning because you can't know everything from the beginning. It's a learning process and most of it comes through try and error. I can understand how many people here get intimidated by arrogant fucks on this board who'll instantly yell at you and calling you stupid and other shit.. Well guess what, they're just insecure incels.

If you don't understand a programming language 100 %, you shouldn't be writing production code in it.

The C++ committee is on a holy mission to make parts of the language as obscure as possible. They invent new concepts and terms all the time, and when you ask about them, they tell you not to worry about it: Those terms are meant for library writers, you should just concentrate on writing application code! It's like they're talking about python and not C++. If a language wants to replace C in the domains where the latter remains dominant, that language has to be understandable, top to bottom, by the average programmer working in those domains. I'm unironically more hopeful about Rust than C++ at this point, CoC or not.

>all these butthurt cniles
lmao

Attached: c_ccomparison[1].jpg (1200x851, 272K)

Dude nobody can get it 100%,

Only a fool thinks he knows everything.
A wise man knows he knows nothing.

context?
also
>non-inline,
not a proper way to compare the two since C++ compilers can inline lambdas, whereas C compiler cannot inline functions given as arguments.

youtu.be/D7Sd8A6_fYU

>that guy who always posts pages from the design and evolution of C++ but has only made it to chapter 4

Attached: C++.png (3633x5542, 524K)

>muh committee
Dude, just because you're a pajeet does not mean everyone else is.

Why do you faggots always try to insist that OOP is the reason people use C++? It only demonstrates your own inexperience and ignorance. I think OOP is harmful. However, I will use C++ over C literally every time it is an option. Why? Because it is literally faster. It uses the stack more efficiently. It lets you give more information to the compiler so that it can optimize things that it otherwise wouldn't know that it can safely do. C++ also has templates, which incur zero performance overhead (compile-time feature) and save you from having to duplicate your code for every type you want to support. C++ has modern features such as cross-platform standardized file-system access, system time methods, and automatic type declarations. C is such a shit-tier language. It should only be used when the target platform does not have a working C++ compiler.

>1:36h long

I'm not watching an hour an a half presentation for one small part of it.

What exactly does Polystate and unbundled/bundled mean?

This, STL containers alone are a large reason to use C++ over C.
However, C does have its place in areas such as real time computing: since you never want to use dynamic allocation and other unpredictable features (in the sense that they may lengthen computation time) it's better to just use a more restrictive language in that case.
No reason to choose C++ over C, however, if you have no such restrictions.

I want students to go and stay go.

Wow incredible arguments.

Embedded developers should go suck a dick.

It should say something about your position if a student can make correct arguments for choosing C++ over C that you can't rebuke.
I spent several weeks evaluating some drivers (written in C, of course) and I cannot tell you how many times I came across "best C practices" to emulate stuff that the offerings of C++ would automatically take care of. The drivers were excellently written (the developers are the leaders in that specific field of driver development) so it's not like anything I observed was a byproduct of bad code, just a byproduct of a limited language. I suspect that those who are quick to dismiss C++ have never actually taken the time to try and understand what problems it can address for them and, at least on this board, probably have no experience working on any substantial piece of software.
Ultimately, C is simple and C++ is complex, and that's really all there is to it. While C is easier to pick up, its simplicity is a limitation and programming in it is inherently more dangerous since it does less for you. While C++ allows one to program more efficiently and safely, its complexity means that it might be a long time before you reach that level where you are more efficient and more safe in all applicable aspects of your programming. (This is why the speaker in advocates that experienced C programmers learn pieces at a time as they're needed, rather than overwhelming them with all the great and glorious features C++ has to offer.) That's my only criticism of C++: it's big, and it's growing very fast. However, that's also why I like it.

>if someone doesn't agree with me he is an insecure incel
Imagine being this insecure and this incel

>cpp/c

Jesus Christ I'm glad that I quit my job. Life's too short for that shit.

You mean you have seen some people use roughly the same 5% subset of C++ that you use.

butthurt students

Butthurt about what, exactly?

qsort uses quicksort which can be in O(n^2) worst case (which is most of the time in practice) whereas sort uses a hybrid between quicksort, heapsort, and insertion sort to have a worst case runtime of O(n log n)

std::sort is also able to do efficient swapping depending on the type implementation/template specialisation.

>(which is most of the time in practice)
You are an idiot if you really think the quicksort worst case comes up most of the time. It's pretty rare even with a naive implementation and even more rare if you are smart about picking a pivot index. You should actually learn how the algorithm works before you spew such nonsense. It only takes a few minutes to understand.

so what? that's not a measurement of worst case

some of these threads are stupid

researchgate.net/publication/285576045_Five_Popular_Myths_about_C

but still all else equal, C++ would be faster because of the use of templates and lambda expression inlining.

You know compiler optimizations exist for C too, right? You can also inline your functions too...

Type safety is a meme for script kiddies

types are also a feature that allow compilers to optimize way more aggressively

Insufferable and insurmountable faggot detected.

>3 unnamed compilers of "differing vintages"
>The dude has a heavy bias towards C++
>cppcon
Fake news

> C and C++ yielded identical performance when inlining
> Just use -O2
Wowee

Is there any other language so shitty that its creator has to constantly make excuses for it?

There's only so much a compiler can do to make your spaghetti code run faster. If you need your hand held, why not just use Python or some shit?

To get the same optimizations manually would require you to use assembly. Most people would rather use types in their code instead of manually performing assembly-level optimizations.

No, because no one uses them.

>excuses
Not excuses, he has to constantly disprove myths about his language because people either want their language to be superior or can't keep up with the times.

It will emit a new sort implementation for every combination of template arguments you pass it.

>There's only so much
A lot in fact.

>spaghetti code
Ctards calling OUR code spaghetti. LOL

C:
#include

int int_comparator(const void *a, const void *b) {
const int *x = a;
const int *y = b;

if (*x < *y) {
return -1;
}
else if (*x == *y) {
return 0;
}

return 1;
}

extern int stuff[256];

int main() {
qsort(stuff, 256, sizeof(int), int_comparator);
}


C++:
#include

extern int stuff[256];

int main() {
std::sort(stuff, stuff + 256);
}

And it'll only get worse when you try to make your comparator capture some scope.

To be honest, you could have simply written return *x - *y

which one, the C one or C++ one?
C++ lambda captures are trivial so I assume you mean the C one.

Yeah, the C one. You'd have to add a void* parameter to the function pointer and then to qsort itself. C APIs like posix threads do that a lot.

I know, it's horrible.

>that comparator func that could have been done in 1 line
>absolute state of C++ tards
if it's not bait then you just proved his point faggot

unsafe

potentially undefined behavior

unsafe how? it's a subtraction not addition, there's no possibility of overflow.
return *(int*)x - *(int*)y

Still unsafe

What do you do if one is INT_MAX and the other is INT_MIN?

Wait nevermind the answer would be either 1 or -1

Someone redpill me on how a programming language can be "bloated"

The C++ lambda syntax is the weirdest shit I've ever seen.

alright i got that wrong, i assumed all values were unsigned.

but you could still have accomplished that in 1 line instead of the whole block
return (*(int*)d1 == *(int*)d2 ? 0 : *(int*)d1 < *(int*)d2 ? -1 : 1);

What... the... fuck.

Why doesn't C++ just remove all of the legacy bullshit? Why are there like 8 ways to instantiate objects and like 5 aren't even recommended for modern C++ yet retards still use them

large library with lots of hidden structures, or basically a language where the compiler error is longer than the code.

I've been using C++ for 14 years, brainlet.

Why is this website on a malware block list?
v.firebog.net/hosts/Airelle-trc.txt

It's pretty much impossible to remove features from a language. Once a language standard is frozen you can't unfreeze it. That's why a lot of new programming languages are really just older languages with the bloat removed.

I actually agree with the C++ side on this even though I'm not a big fan of C++. The qsort function always felt really out of place in C. My ideal world would negate the need for such a comparison because the qsort function wouldn't exist.

You can accomplish everything in 1 line excluding preprocessor directives.
What's your fucking point?

I like having auto pointers and generics that aren’t just void pointers though.

>C and C++ fags bleating at each other
>meanwhile you're stuck in python-land
I can't believe I'm saying this but I miss the fuck out of C and C++ lads. You require a certain degree of competency to write stuff in C above a certain complexity, and while you can be a total piece of shit more often than not that competency means people write code that can be easily structured and tested

Python fags on the other hand just use it as 'code chickenscratch'. No need for structure or sanity just do whatever the fuck you want and if you piss around with it enough it'll eventually sort of work. Then get someone else (like yours truly) to write unit tests for some one else's monstrosity because you have stability and quality problems

God I fucking hate python. I also hate unit test fags and the 100% coverage meme. Fuck people that think you can write messy shitty code then tell someone else to retrofit unit tests to it and it'll magically improve quality. Fuck explaining to people that the code wasnt written to be unit tested and its a waste of time (no free functions, virtually no public api with side effects that can be measured, everything is interlinked and interconnected, you need to mock 50 things to test one fucking miserable little function that's a private implementation detail anyway)

JS and Python need to be purged. Give me my fucking type safety and compiler checks back jesus

Attached: asdasd.jpg (480x360, 14K)