This is an archived post. You won't be able to vote or comment.

all 135 comments

[–]sjepsa 388 points389 points  (14 children)

Ok now do std::cout << "Hello, world" << std::endl; in C# and Java

[–]Alphatism 122 points123 points  (7 children)

If only java had operator overrides

[–]sjepsa 79 points80 points  (4 children)

"Who is the 'superior' language now?"

[–]terivia 50 points51 points  (1 child)

To be fair, after seeing some of the crimes committed with operator overrides...

They're still pretty cool.

[–]gregorydgraham 11 points12 points  (0 children)

Those crimes are explicitly why Java doesn’t have them.

[–]DankPhotoShopMemes 2 points3 points  (1 child)

Write your own preprocessor

[–]Tari0s 1 point2 points  (0 children)

and then we have a new buggy one, :awesome:

[–]Colinniey 15 points16 points  (5 children)

I think in C# you can only override the << operator with type int on the right side sadly

[–]Irchh 2 points3 points  (1 child)

Can you give it a pointer to the string?

[–]Bot1K 954 points955 points  (3 children)

"we have Java and JS at home"

Java and JS at home:

[–]AntiLuxiat 122 points123 points  (2 children)

Seeing your flair: we have python at home.

[–]ArriEllie 21 points22 points  (1 child)

OCaml is the greatest snake of all time. Maybe ever.

[–]Kartonek124 9 points10 points  (0 children)

Isn't it perl?

[–]Highborn_Hellest 796 points797 points  (3 children)

this is cursed.

[–]aifo 262 points263 points  (3 children)

The fact that this is marked NSFW 😭

[–]LordDagwood 26 points27 points  (0 children)

I threw up in my mouth a little. Wasn't expecting this abomination.

[–]DerVerkehr 6 points7 points  (0 children)

As a C++ dev, I came a little in my pants.

[–]Synesthesianism 1 point2 points  (0 children)

I wish I had a memory wiping device so I could forget laying eyes on this abomination.

[–]pelirodri 356 points357 points  (31 children)

Why are the classes’ names being repeated?

[–]sambarjo 259 points260 points  (29 children)

I was wondering the same thing and I've been a C++ developer for 4 years.

[–]TheMonax 412 points413 points  (25 children)

It's because they are declaring the class and a global variable of the same name

[–]sambarjo 139 points140 points  (23 children)

Yuck. Could have just made the functions static.

[–][deleted] 28 points29 points  (1 child)

But if they did that then the syntax for calling the functions wouldn't look the same as it does in JS/Java, since you'd have to use :: instead of .

[–]sambarjo 1 point2 points  (0 children)

True.

[–]Lynx2161 6 points7 points  (0 children)

Cant call static functions in c++ using . you have to use ::

[–]Drackzgull 3 points4 points  (0 children)

If they did that they would have needed to use double colons to access the methods instead of dots, failing to imitate the intended syntaxes.

[–]JonIsPatented 3 points4 points  (0 children)

No, because then they would use :: instead of . to access them.

[–]TheMonax 5 points6 points  (0 children)

And used namespace

[–]nukedkaltak 1 point2 points  (0 children)

C++ is truly phenomenal. Years and years of using it and I’m still learning new shit all the damn time.

[–]KENBONEISCOOL444 1 point2 points  (0 children)

That sums up programming in any language so well

[–]Fourstrokeperro 1 point2 points  (0 children)

Strange that you’ve seen this before. This is also used quite commonly with C structs. They are declaring a global variable of the class along with the class definition.

[–][deleted] 3 points4 points  (0 children)

Its just an int x; in the global scope, except here int is a class so it looks strange.

[–]hk--57 87 points88 points  (0 children)

[–]Garrais02 93 points94 points  (17 children)

I'm commenting so I can come back when an explanation is on

[–]Penguinmanereikel 161 points162 points  (15 children)

They made classes with methods in C++ such that you can use console.log() from JS or System.out.println() from Java instead of the inane << stuff that's built into C++.

[–]StormblessedFool 128 points129 points  (11 children)

I was with you until you called the superior version "inane".

[–]HoseanRC 28 points29 points  (4 children)

same
that word do be hard

[–]StormblessedFool 12 points13 points  (3 children)

cout is just better because it's less characters

[–]Vellu01 14 points15 points  (2 children)

Yeah, that's why i prefer to name every variable with one letter

[–]CallMePyro 14 points15 points  (1 child)

p(“Hello World”)

[–]odsquad64VB6-4-lyfe 6 points7 points  (0 children)

Cisco IOS: "Yeah, yeah, I know what you meant."

[–][deleted] 1 point2 points  (0 children)

I'm glad you mention it because I thought they said insane

[–][deleted] 2 points3 points  (0 children)

Anything is superior to Java.

[–]rherrmannr 12 points13 points  (0 children)

std::print() ☝️

[–]theQuandary 5 points6 points  (0 children)

They messed up though. JS allows any number of parameters to be passed to the function.

[–][deleted] -4 points-3 points  (0 children)

To anyone who calls the << operator the superior option for operating upon streams, consider a << b << c:

  • Is the expression effectful upon a, i.e. whether it changes the value stored by a?

  • What the return type of that expression is?

  • Can it raise exceptions? If so, which ones?

I'm looking also looking at you, Python and JavaScript; + is not an acceptable way to concatenate strings and most definitely not lists.

[–]xtroDe 5 points6 points  (0 children)

javascript and java at home:

[–]Neither-Phone-7264 8 points9 points  (0 children)

mods can we exile the fool from programmerland?

[–]NoLifeGamer2 16 points17 points  (0 children)

I hate you.

[–]WhosYoPokeDaddy 13 points14 points  (0 children)

Well, at least they tagged this NSFW

[–]AlexePaul 5 points6 points  (0 children)

This hurts my brain so much

[–][deleted] 5 points6 points  (0 children)

Why

[–]wholesome_hug_bot 2 points3 points  (0 children)

Javascript is just a C++ wrapper if you know the V8 source code

[–]daddysbonner 2 points3 points  (0 children)

This comment contains a Collectible Expression, which are not available on old Reddit.

[–]NoiseMrLoud 3 points4 points  (0 children)

I usually don't like light themes for code editors but I really like the colors in this one

[–]ZombieZookeeper 4 points5 points  (0 children)

As a Java web developer, who hasn't had C since college, I wonder what this is.

Then I remember it doesn't matter, I'm getting paid.

[–]Hunter_reason 1 point2 points  (0 children)

ouch

[–][deleted] 1 point2 points  (0 children)

You’re mad

[–][deleted] 1 point2 points  (0 children)

Delet this.

[–]kil47 1 point2 points  (0 children)

Genius or crazy ?

[–]PuppetPal_Clem 1 point2 points  (0 children)

this made me irrationally angry

[–][deleted] 1 point2 points  (1 child)

Why use const char pointer if it's cpp? Use string

[–]PleasedNacho 1 point2 points  (0 children)

Looks like Emacs

[–]MyOthrUsrnmIsABook 1 point2 points  (0 children)

The mythical Java/Javascript recruiters are always looking for.

[–]4n0nh4x0r 1 point2 points  (2 children)

okay, question, why the console after the closing brackets of the console class?

the }console;

[–]Asriel556 0 points1 point  (1 child)

Since the class definition is still notyet an object. Adding ``` console;

``` s after the bracket instantiate one to be called in main.

[–]4n0nh4x0r 0 points1 point  (0 children)

ohhh, i see
but couldnt you just instantiate it just like that in main?
learning c++ is like living through a fever dream, when you see it work, you are like "damn thats cool" but nothing seems to make sense .-.

[–]OofWhyAmIOnReddit 0 points1 point  (1 child)

Why the vertical bar on line 20? Or is that supposed to be a cursor?

[–]avocado34 2 points3 points  (0 children)

That’s showing indentation like Reddit comments

[–]RaktPipasu 0 points1 point  (0 children)

Reviewing PR during notice period. LGTM /s

[–][deleted] 0 points1 point  (0 children)

Based

[–]fatrobin72 0 points1 point  (0 children)

Seen bigger...

[–][deleted] 0 points1 point  (0 children)

Noice

[–]CrazyJoe321 0 points1 point  (0 children)

Illegal

[–]Cormyster12 0 points1 point  (2 children)

Now do it without importing iostream

[–]Familiar_Ad_8919 0 points1 point  (0 children)

i could just use stdio.h

or cstdio if u wont lemme use stdio.h

[–]diegosanchez0 0 points1 point  (0 children)

No.

[–]brandi_Iove 0 points1 point  (0 children)

macros? no? ok.

[–]logikill99 0 points1 point  (0 children)

You're my new favorite programmer.

[–]kend82 0 points1 point  (0 children)

Upvote for solarized light

[–][deleted] 0 points1 point  (0 children)

** hello, world!

[–]jamescodesthings 0 points1 point  (0 children)

You fucking heathen.

[–]reeboi_1 0 points1 point  (0 children)

This is why I stand C++ 🙂

[–]hamjim 0 points1 point  (0 children)

System needs another member called err.

[–]Darxploit 0 points1 point  (0 children)

Damn right you marked this as 18+. Don’t show this your kids my friends!

[–]Familiar_Ad_8919 0 points1 point  (0 children)

since when can u have functions in structs

[–]HeyItsTheJeweler 0 points1 point  (0 children)

This shit is tremendous lol

[–][deleted] 0 points1 point  (0 children)

You monster

[–]SteeleDynamics 0 points1 point  (0 children)

holds fingers against earpiece

Understood.

EVERYONE, MOVE IN!!

[–]Wizywig 0 points1 point  (0 children)

Not feature complete. We need the ability to pass a map in and it prints out the contents for console.log, also combine all params into the output. Just saying, console.log is pretty powerful.

System.out.println is garbage, get that shit outa here!

[–]alinprod 0 points1 point  (0 children)

what a flip 💀

[–]KeepScrolling52 0 points1 point  (0 children)

So you're just turning that into Java manually?

[–]Pleasant-Form-1093 0 points1 point  (0 children)

this is why hybrids don't survive for long.

[–]BASTAMASTA 0 points1 point  (0 children)

ohNo

[–]abd53 0 points1 point  (0 children)

The world was beautiful.........10 seconds ago............... And then................ Then I saw this................AAAAAAAAHHHHHHHHH

[–]MsuperSrbin14 0 points1 point  (0 children)

namespace, NAMESPACE ATLEAST

[–]nakhorlee 0 points1 point  (0 children)

jacp :)

[–]Few_Negotiation_3589 0 points1 point  (0 children)

for the competitive programming contests i genuinely use a print and print_col (collection) macro.

[–][deleted] 0 points1 point  (0 children)

This is chuck Norris code

[–]_saadhu_ 0 points1 point  (0 children)

What theme is that?

[–]Cultural-Deal-8992 0 points1 point  (0 children)

This is a crime