Why is C++ so popular in competitive programming

If C++ is so bad, why do so many competitive programmers use it?

Other urls found in this thread:

catonmat.net/blog/programming-competitions-work-performance/
doc.rust-lang.org/book/
twitter.com/NSFWRedditVideo

It's fast and simple

Shit to program in, but the code (if written well) is fast

>simple

they have to compesate something really small they have

It’s fast and has more libraries than you could ever wish for. That and it’s OO if you need it or functional if you don’t.

>competitive programming
HAHAHAHAHAHAHAHAHAHAHAHAHAHA

They used it for two reasons:
1. Maintaining old legacy code that was written in C++.
2. For fast performance, native binaries, or for system-level code.

Now only the first reason remains. For new projects that need the fast / native / system-level features, Rust is being selected instead. Rust is a new, modern programming language that provides the benefits of C++ without the downsides.

catonmat.net/blog/programming-competitions-work-performance/

because competitive programmers are bad programmers, so it's only fitting that they would use a shitty language

We are very proud to say that Rust won first place for "most loved programming language" in the Stack Overflow Developer Survey in 2016 and 2017.

Learn Rust today at: doc.rust-lang.org/book/

Gaps in their knowledge?

Rust is shit to competitive programming, write generic high performance data struct is too hard in rust.

I find it way simpler than java

Problem setters using C++ means write problems thinking on C++, high IO, compute hard problems.

For example some problems almost requiere you write high tricky optimize code on C++.

Yet you're not proud enough to use Redox OS.

> write generic high performance data struct is too hard in rust
then try harder

This is a loaded question and should have been ignored for that reason. Sagethis

> shit to program in

then tell me one thing that's really unpleasant to do with C++
I'm waiting

>competitive programmers

> shill against C++
> convince people to learn Rust
> keep all the C++ jobs for yourself

Erm.... Java is a subset of c++.
Also, c++ has a clustefuck of features

writing computer software is very unpleasant to do with c++

...

That picture is supposed to prove a point I am assuming?

Lol I already debunked that several times on this board.

With C++11 you can forgo the trailing return type.
With C++17 you can forgo the template parameter type.

All of the sudden, it becomes pleasantly readable, even to the complete normie.

But normally you don't have to do much crazy template programming like that. You can just use the make_resource or whatever function you need that someone else wrote for you.

yes. did you segfault while looking at it?

>competitive programmers
What the hell is that?
Battle Programmer Shirase?

>Understanding the Latin alphabet
>What is "a"?
>*Maybe a letter in a longer word
>*Maybe an article in front of another word
>*Maybe a variable in a function
>*Maybe a constant in a function
>*Maybe a letter in a longer identifier
>*Maybe it is pronounced closer to an "e" instead of an "a"
>*Maybe several of the above!

The Latin alphabet is shit. q.e.d.
We need to switch to a new character system that has distinct character sets for each purpose.

a bunch of guys that got picked last in gym class

that's the second worst analogy I've seen this month

>that's the second worst analogy I've seen this month
Please post the worst one.
[spoiler]It's a food analogy, right?[/spoiler]

Because it's the only language worth a damn for parallel computing competition

Now you're getting it
Asia has the right idea

>Asia has the right idea
Not really. Their reading system is shit. At least in Chinese and Japanese.
The same word may have a fuckton of different readings that are all equally valid, but that have different meanings.
It's a fucking mess.

> le second worst xDDD

Go back to reddít. Stay there. You're not entertaining, you're not an intellectual and you don't belong here.

>Erm.... Java is a subset of c++.
No Java is syntactically similar to C++ but isn't a sub-set or super-set or anything else related to C++ at all.

>Also, c++ has a clustefuck of features
Doesn't mean you have to actually use them all though.

because old farts cannot learn python

everyone just uses a crate because complex data structures are such a bitch to write from scratch in rust

What the fuck is "competitive programming"?

Because it has a large standard library and Java IO is painfully slow which can cause problems to fail the time limit.

>competitive programming

i swear to god some people

Probably because people who are very good at writing performant code (and thus have a good chance of actually winning or at least reaching the top of the scoreboard) use C++ in their day jobs, so it's what they wind up using since they're most accustomed to it.

>c++
>functional

i haven't heard such a fucking meme since chink moot started yelling at us.

For yourself and India.

fast language
lots of libraries
very complicated language, but many people are just familiar with it

if you're a good programmer in general you can program in pretty much any language, so you can even get used to c++. and once you're used to something and you can get stuff done with it, there's no real reason to switch.

Competitive programming doesn't matter.

luv 2 use a programming language thats as messy as a natural fucking language

If you use modern C++, it's much safer and less of a headache.

it's fast and has a lot of cool libraries for problem solving.

> competitive programmers
>implying they mean fucking anything

I always forget that Sup Forums is mostly virgin highschoolers and undergrads.

competitive programming isn't actually real life programming

it's more about recalling algorithms and math

that's the fun thing about programming though

Exactly the reason you cited, "competitive".
Everyone wants to be elitist and work with the fastest most efficient tech, otherwise you're stupid or you suck or you're inadequate.

C++ has bastardized programming though.
It spawned Java, which spawned C#, which all pushed the C++ OOP model even further.
The STL, all the rubbish Computer Science concepts like Linked Lists.

I really hope it all disappears in another 10 years. How much more can you abstract the base hardware? Virtual base interface classes? What does that have to do with anything?

>otherwise you're stupid or you suck or you're inadequate.

Why do you people want to make stating obvious facts illegal?

That is the age we live in, it's illegal to state the obvious because reality hurts millenials. My generation is fucking disgusting.

It's the only thing that can do everything.

C++ is just terrible.
Every idea seems good until you actually try to use it.
Like RAII. RAII is an excellent concept. But that means you have to use constructors. Constructors can't return an error. You can throw an exception (which is what most of C++ does) and endure C++'s horrendous exception model. Or you can record the error (wastefully bloating the size of your object) and test for it later e.g. by overloading operator bool - which is just as unergonomic as your typical C-style init function, but also more error prone because it "looks" right.
struct Foo foo;
foo_dothings(&foo);
// obviously wrong, where's the init?

struct Foo foo;
foo_init(&foo);
foo_dothings(&foo);
// much better

Foo foo;
foo.doThings();
// is that right?

Foo foo;
if (foo)
foo.doThings();
// oh fuck that was it

Very few C++ features come without strings attached. Constexpr is one of the only ones I can think of which doesn't have any strange gotchas.

brainlets should not be programmers

competitive programmers here.

because there is no real alternative.

in competitive programming, speed + memory is important => ruby/python is out.
some hacks use java, but they can't never reach the top

c stdlib is shit, and nobody got time to implement basic data structure (like deque, hash map) or algorithm (sort, binary search) in those competitions.

pascal is nice, but too verbose and outdated.

Am I the only person on this board who actually enjoys using C++?
It's a powerful language with a lot of useful features, it's fast and has amazing libraries.

It's a mixed bag for me. It's very expressive but everything feels like an inelegant hack or a workaround.
>Within C++, there is a much smaller and cleaner language struggling to get out.

>>Within C++, there is a much smaller and cleaner language struggling to get out.
C?

>pascal
first real language i learned, weird to see it mentioned because i'd assumed it was dead by now

is there a decent pascal scene?

Nah, C isn't expressive at all. It is at least robust and simple.

>There are actually people on Sup Forums using C or C++ instead of Rust in 2017

I am coming from C++ to Rust but C++ post 0x is so good.
-Mozilla
-SJW Squad
-Integrated toolchain
+Alternatives growing

kinda stuck with it since i was in high school and it just works

> he unironically believes people with shit education can write maintainable, safe, bug-free C++

>cutting off your penis as part of the CoC
No thanks, I don't like politics in my programming language.

I'm a shitty undergrad competitive programmer at a no name school. We use C++ because it's what we learn in and what we write most of our assignments in. And the STL with means you can get most things done quickly. If you need to write your own data structure you can write a class and with the right overloads still use things from

It's a very VERY powerful tool but requires a lot of responsibility from the user.
Ie, using your fucking brain.
Seriously anyone that can't handle it is a brainlet.

You don't know what functional programming is if you think this is true. You mean imperative.

>pajeets coding in c++
after seeing their java i think i'll skip thank you very much

shhhhhh, they still think it’s 2003 and/or C++ hasn’t evolved since then

it's shameful that C++ didn't really get useful until C++11, and even then it's quite flawed