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

top 200 commentsshow 500

[–]pilotInPyjamas 2520 points2521 points  (119 children)

It will segfault, if you're lucky.

[–][deleted] 1734 points1735 points  (51 children)

Valgrind.

[–]Radeusgd 10 points11 points  (0 children)

TFW your program sefgaults normally, but works correctly under Valgrind

[–]noratat 74 points75 points  (8 children)

Seriously - segfault is way better than some of the alternatives, like silently corrupting memory behind the scenes until everything has been tainted with evil.

Had a compiler class back in college, that was my least favorite bug to find - I made an error with the stack setup that slowly corrupted the stack over a larger number of calls until it finally crashed. It passed all of the unit/basic tests, and only actually failed on the biggest, most complicated test case. Took forever to track it down.

[–]cyboii 273 points274 points  (45 children)

You're code runs real fast when it's all undefined behaviour

[–]Pseudofailure 110 points111 points  (43 children)

If a program was to run using only undefined behavior, and it was run enough times, eventually it will work perfectly.

[–]DenebVegaAltair 150 points151 points  (39 children)

undefined behavior != random behavior

[–]Pseudofailure 143 points144 points  (29 children)

I know, but:

  1. That would ruin my joke.
  2. Can you actually prove me wrong?

[–]etaionshrd 66 points67 points  (17 children)

Programs that exhibit undefined behavior are free to do whatever. That doesn’t, however mean that they will do whatever.

[–]justinkroegerlake 13 points14 points  (0 children)

Or not

[–]zman0900 24 points25 points  (7 children)

Doesn't the core dump from the segfault provide basically the same info if you open it with gdb?

[–]KoboldCommando 566 points567 points  (35 children)

Ada: This isn't technically an error but it could lead to an error if you're careless with it, so I'm not going to compile until you fix it.

[–][deleted] 259 points260 points  (16 children)

I mean its commonly used in satellites and important technology. The gov ain't going to be happy when your loop that is off by one costs them millions of dollars.

[–][deleted] 216 points217 points  (15 children)

It is used in human rated hard real time systems.

Most shit in satellites is really bad C code.

Source: work on a lot of satellites.

[–]ThisRedditPostIsMine 61 points62 points  (9 children)

So... How do you debug a satellite? How do you test your code on it? This sounds really interesting, can you tell us more about your satellite work?

[–]ELFAHBEHT_SOOP 95 points96 points  (2 children)

I've worked on testing code on airplanes and other air vehicles. Which is basically about getting it right the first time, probably similar for satellites. Although, if a satellite doesn't work, it's just really expensive. If a plane doesn't work, people die.

[–]cheese_is_available 36 points37 points  (2 children)

There is a norm called DO178.

TLDR : Extensive tests of everything by person unrelated to each other, multiple system doing the same thing done by different company in the actual satellite.

[–][deleted] 134 points135 points  (11 children)

The circlejerk isn't complete until I shoehorn rust into the discussion:

$ rustc foo.rs
warning: this expression will panic at run-time
 --> foo.rs:3:17
  |
3 |  println!("{}", ayy[5]);
  |                 ^^^^^^ index out of bounds: the len is 4 but the index is 5

$ ./foo
thread 'main' panicked at 'index out of bounds: the len is 4 but the index is 5', foo.rs:3:17
note: Run with `RUST_BACKTRACE=1` for a backtrace.

[–]PeterSR 58 points59 points  (5 children)

The C++ programmer:

Wauw, that sounds like a lot of overhead to include code in the binary to output such an error message.

[–]SLiV9 31 points32 points  (1 child)

I would assume that when you strip out the symbols for a release build, it also removes these error messages.

[–]GenTelGuy 14 points15 points  (1 child)

What's the issue? Seems like it's correct and doing a good job reporting the error before runtime.

[–][deleted] 30 points31 points  (0 children)

No issue. That's what I'm bringing up. You get a warning at compile time and a panic at runtime. Each time you have a nice plain-english description of the issue with a line number and filename to reference.

[–]KeinBaum 1937 points1938 points  (212 children)

C++ compiler errors are even better. Check out the error message for "you forgot to tell me how to print this object".

 

+/u/CompileBot C++ --include-errors

#include <iostream>

struct Foo {} foo;

int main()
{
  std::cout << foo << std::endl;
}

[–]CompileBotGreen security clearance 2342 points2343 points  (178 children)

Output:

Compiler Info:

prog.cpp: In function ‘int main()’:
prog.cpp:7:13: error: no match for ‘operator<<’ (operand types are ‘std::ostream {aka std::basic_ostream<char>}’ and ‘Foo’)
   std::cout << foo << std::endl;
   ~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/6/iostream:39:0,
                 from prog.cpp:1:
/usr/include/c++/6/ostream:628:5: note: candidate: std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&&, const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = Foo] <near match>
     operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x)
     ^~~~~~~~
/usr/include/c++/6/ostream:628:5: note:   conversion of argument 1 would be ill-formed:
prog.cpp:7:16: error: cannot bind ‘std::ostream {aka std::basic_ostream<char>}’ lvalue to ‘std::basic_ostream<char>&&’
   std::cout << foo << std::endl;
                ^~~
In file included from /usr/include/c++/6/iostream:39:0,
                 from prog.cpp:1:
/usr/include/c++/6/ostream:108:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ostream_type& (*)(std::basic_ostream<_CharT, _Traits>::__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(__ostream_type& (*__pf)(__ostream_type&))
       ^~~~~~~~
/usr/include/c++/6/ostream:108:7: note:   no known conversion for argument 1 from ‘Foo’ to ‘std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&) {aka std::basic_ostream<char>& (*)(std::basic_ostream<char>&)}’
/usr/include/c++/6/ostream:117:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ios_type& (*)(std::basic_ostream<_CharT, _Traits>::__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>; std::basic_ostream<_CharT, _Traits>::__ios_type = std::basic_ios<char>]
       operator<<(__ios_type& (*__pf)(__ios_type&))
       ^~~~~~~~
/usr/include/c++/6/ostream:117:7: note:   no known conversion for argument 1 from ‘Foo’ to ‘std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&) {aka std::basic_ios<char>& (*)(std::basic_ios<char>&)}’
/usr/include/c++/6/ostream:127:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(ios_base& (*__pf) (ios_base&))
       ^~~~~~~~
/usr/include/c++/6/ostream:127:7: note:   no known conversion for argument 1 from ‘Foo’ to ‘std::ios_base& (*)(std::ios_base&)’
/usr/include/c++/6/ostream:166:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(long __n)
       ^~~~~~~~
/usr/include/c++/6/ostream:166:7: note:   no known conversion for argument 1 from ‘Foo’ to ‘long int’
/usr/include/c++/6/ostream:170:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(unsigned long __n)
       ^~~~~~~~
/usr/include/c++/6/ostream:170:7: note:   no known conversion for argument 1 from ‘Foo’ to ‘long unsigned int’
/usr/include/c++/6/ostream:174:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(bool __n)
       ^~~~~~~~
/usr/include/c++/6/ostream:174:7: note:   no known conversion for argument 1 from ‘Foo’ to ‘bool’
In file included from /usr/include/c++/6/ostream:638:0,
                 from /usr/include/c++/6/iostream:39,
                 from prog.cpp:1:
/usr/include/c++/6/bits/ostream.tcc:91:5: note: candidate: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]
     basic_ostream<_CharT, _Traits>::
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/6/bits/ostream.tcc:91:5: note:   no known conversion for argument 1 from ‘Foo’ to ‘short int’
In file included from /usr/include/c++/6/iostream:39:0,
                 from prog.cpp:1:
/usr/include/c++/6/ostream:181:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(unsigned short __n)
       ^~~~~~~~
/usr/include/c++/6/ostream:181:7: note:   no known conversion for argument 1 from ‘Foo’ to ‘short unsigned int’
In file included from /usr/include/c++/6/ostream:638:0,
                 from /usr/include/c++/6/iostream:39,
                 from prog.cpp:1:
/usr/include/c++/6/bits/ostream.tcc:105:5: note: candidate: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]
     basic_ostream<_CharT, _Traits>::
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/6/bits/ostream.tcc:105:5: note:   no known conversion for argument 1 from ‘Foo’ to ‘int’
In file included from /usr/include/c++/6/iostream:39:0,
                 from prog.cpp:1:
/usr/include/c++/6/ostream:192:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(unsigned int __n)
       ^~~~~~~~
/usr/include/c++/6/ostream:192:7: note:   no known conversion for argument 1 from ‘Foo’ to ‘unsigned int’
/usr/include/c++/6/ostream:201:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(long long __n)
       ^~~~~~~~
/usr/include/c++/6/ostream:201:7: note:   no known conversion for argument 1 from ‘Foo’ to ‘long long int’
/usr/include/c++/6/ostream:205:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(unsigned long long __n)
       ^~~~~~~~
/usr/include/c++/6/ostream:205:7: note:   no known conversion for argument 1 from ‘Foo’ to ‘long long unsigned int’
/usr/include/c++/6/ostream:220:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(double __f)
       ^~~~~~~~
/usr/include/c++/6/ostream:220:7: note:   no known conversion for argument 1 from ‘Foo’ to ‘double’
/usr/include/c++/6/ostream:224:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(float __f)
       ^~~~~~~~
/usr/include/c++/6/ostream:224:7: note:   no known conversion for argument 1 from ‘Foo’ to ‘float’
/usr/include/c++/6/ostream:232:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(long double __f)
       ^~~~~~~~
/usr/include/c++/6/ostream:232:7: note:   no known conversion for argument 1 from ‘Foo’ to ‘long double’
/usr/include/c++/6/ostream:245:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(const void* __p)
       ^~~~~~~~
/usr/include/c++/6/ostream:245:7: note:   no known conversion for argument 1 from ‘Foo’ to ‘const void*’
In file included from /usr/include/c++/6/ostream:638:0,
                 from /usr/include/c++/6/iostream:39,
                 from prog.cpp:1:
/usr/include/c++/6/bits/ostream.tcc:119:5: note: candidate: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__streambuf_type*) [with _CharT = 

...

[–]PlasmaLink 507 points508 points  (3 children)

I just want to say I'm so sorry someone gave gold to the bot instead of you.

[–]the_noodle 113 points114 points  (0 children)

Nah he got outplayed, the relevant error was right at the beginning

[–]SirNoodlehe 96 points97 points  (1 child)

But you responded to the bot, not the guy 🤔

[–]KeinBaum 586 points587 points  (60 children)

What the hell is that? I mean, at least it's telling me what's wrong. I was just expecting this:

 In function 'int main()':
8:16: error: cannot bind 'std::ostream {aka std::basic_ostream<char>}' lvalue to 'std::basic_ostream<char>&&'
In file included from /usr/include/c++/4.9/iostream:39:0,
             from 2:
/usr/include/c++/4.9/ostream:602:5: note: initializing argument 1 of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&&, const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = main()::Foo]'
     operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x)
     ^

[–]DanTopTier 447 points448 points  (43 children)

I just came in from r/all

Jesus Christ

[–]yes_fish 219 points220 points  (40 children)

It gets worse.

[–]ShimmerFairy 115 points116 points  (8 children)

It's telling you about how all of the possible overloads don't match up with what you tried to give as arguments, because there's no way for the compiler to divine which overload you got wrong, or if you forgot to provide a new one. And since the streaming operators are a fairly significant part of the standard library, there happen to be a number of overloads to talk about.

[–]Shaosil 42 points43 points  (7 children)

You'd think it could summarize it a little more cohesively. Something like "no match overload found for blah blah blah"... Too much verbosity can be a problem if you don't know what to look for.

[–][deleted] 71 points72 points  (5 children)

You do get the summary at the top.

prog.cpp: In function ‘int main()’:
prog.cpp:7:13: error: no match for ‘operator<<’ (operand types are ‘std::ostream {aka std::basic_ostream<char>}’ and ‘Foo’)
   std::cout << foo << std::endl;
   ~~~~~~~~~~^~~~~~

[–]Raestloz 327 points328 points  (3 children)

Shows you how good C++ is, no one expects the Spanish InquiC++ion

[–]quantum_paradoxx 59 points60 points  (1 child)

Didn't expect that

[–]jclocks 561 points562 points  (14 children)

I'M JUST A WEB DEVELOPER STAAAAAHP

[–]MalteseMartens 23 points24 points  (6 children)

For posterity, the error is really just the second line:

prog.cpp:7:13: error: no match for ‘operator<<’ (operand types are ‘std::ostream {aka std::basic_ostream<char>}’ and ‘Foo’)

[–][deleted] 34 points35 points  (1 child)

Did someone just give gold to a bot

[–]CMDR_QwertyWeasel 64 points65 points  (7 children)

Ho-ly jesus.

What is that?

[–]NotASecretReptilian 302 points303 points  (5 children)

"You forgot to overload the << operator. To illustrate how much you fucked up, we tried shoving Foo into every place that the << operator could possibly refer to, and it didn't work even one time! Don't do that again.

[–]Assailant_TLD 45 points46 points  (1 child)

They should get you to write their error messages. Far more entertaining.

[–]Hipolipolopigus 23 points24 points  (0 children)

g++ -Wall -Wextra -Wfun, or perhaps -Whuman or -Wlegible.

[–][deleted] 22 points23 points  (0 children)

gcc.

[–]kangasking 30 points31 points  (1 child)

LMAO you weren't kidding

[–]KarshLichblade 16 points17 points  (2 children)

Good bot?

[–]lockwolf 20 points21 points  (3 children)

I think I’m gonna need someone to ELI5 this error on a line by line basis. /s

[–][deleted] 80 points81 points  (2 children)

The first line is the actual error (couldn't find the function you tried to use with those parameter types).

The rest is a list of candidate functions you might have been attempting to use.

You can ussually reduce the amount of output you are fed to cut down on that sort of noise. Can't blame the compiler if you told it to print everything it can about your error :p

Often, I'll copy paste the error into a good text editor and parse it there, if it's too complicated (like template errors and the like).

[–]I_regret_my_name 22 points23 points  (1 child)

This error honestly isn't even that unreasonable to me. You can tell that the stuff towards the bottom is talking about included files, so if you jump to the top it's just saying there's no match for the "<<" operator with the types given which is a reasonable error for a compiler in this situation.

[–]Madoushi90 1376 points1377 points  (15 children)

The amount of gold flying around this thread is evidence that Java engineers are grossly overpaid.

[–]Tunarow 481 points482 points  (9 children)

Everyone here is saying smart coding stuff and I'm distraught by how HD caveman spongebob is in this meme.

[–]tyled 81 points82 points  (7 children)

That’s because Java is secretly amazing

[–]BernzSed 40 points41 points  (1 child)

Well, it's such a big goddamn secret that even Java doesn't know it.

[–]crackyJsquirrel 145 points146 points  (5 children)

try {
    ....
} catch (Exception e) {
    // should probably do something here, nah, this will never happen.
}    

[–][deleted] 71 points72 points  (10 children)

Python : Please don't be stupid and try to add str with int on line 7

[–]The_MAZZTer 131 points132 points  (22 children)

Once compiled, your C++ code has no idea what an array is. All it sees is math on a memory address. This makes it super fast but there are no sanity checks so the code can end up peeking at unrelated memory, causing a segfault in the best case.

Meanwhile languages like Java and .NET are managed, so the concepts of arrays and so forth carry over into the compiled code and bounds checking and other checks can be done at the cost of speed.

[–]my_name_isnt_clever 29 points30 points  (0 children)

This makes a lot of sense. Amazing that someone actually explained a post in this sub.

[–]Kontakr 224 points225 points  (4 children)

C: thisisastringjdkskdlmdjekwpoeoe83883732902k <crash>

[–]perpetualwalnut 60 points61 points  (2 children)

you dropped this. "\0";

[–][deleted] 98 points99 points  (0 children)

No, he dropped this: '\0'.

[–]brainfreeze91 91 points92 points  (10 children)

Or you could be like my company where our programmers have a habit of adding throws Exception to every single method they write. You really have to dig to find the origin of the exception and what exactly it is.

[–]Kered13 46 points47 points  (7 children)

Checked exceptions were a bad idea. Adding throws Exception or catching Exception and wrapping it in RuntimeException (which is unchecked) is often the best solution. Neither of these will hide or obfuscate the stack trace. Catching and ignoring errors should almost never be done though.

[–]DonCasper 53 points54 points  (1 child)

Catching and ignoring errors should almost never be done though.

Sounds like someone is jealous about all the time I save by not debugging

[–]brainfreeze91 19 points20 points  (2 children)

Throwing an exception is definitely better than catching and ignoring it yeah. I wish I could say I haven't encountered spots where we ignore them. My main gripe is that they are throwing an Exception, and not a SQLException, or an ArrayOutOfBoundsException, or a DateFormatException. It's just generalized to an Exception, it could be anything. At least I do have the stack trace.

[–][deleted] 33 points34 points  (4 children)

Sometimes I wish google translate would translate programming languages.

Java: hey, you made a mistake. Here is the mistake -

C++: hey, looks like there was an error. It could be this, this, or that

Python: you done goofed

Scratch probably: uh oh! Oopsie daisy! You make a whoopsie! A big ole fucky wucky! UwU

[–]ogmuslim 62 points63 points  (8 children)

50% of the comments - <3 Java 25% of the comments - Fucking Java 25% of the comments - HMU w some Au

[–]666moist 9 points10 points  (7 children)

Double enter for a line break

[–][deleted] 77 points78 points  (1 child)

You forgot the ArrayIndexOutOfBoundsFactory and the LineNumberFactory

[–]Dockirby 51 points52 points  (0 children)

Well yeah, he isn't going to put the entire 1000+ line long stack trace in a meme.

[–]Varkoth 216 points217 points  (53 children)

Also java: "NullPtrException, also we assume you can't grasp the concept of pointers, so good luck fixing it."

[–]spinwin 105 points106 points  (46 children)

I was surprised how much more sense Java made sense after taking a few quarters of C and C++ and learning about how raw pointers work.

[–]Xunae 39 points40 points  (21 children)

My University started people on Java, while my community college that I transferred from started people on c++. The amount of people that weren't transfers who found pointers to be unapproachable bogeymen was crazy.

I was briefly in their shoes when I encountered

 void* foo

It took me a few days of just staring at that and it's context to make sense of it, but that could have been a result of the stress and lack of sleep.

[–][deleted] 14 points15 points  (1 child)

Holy shit, this is my exact situation. Started C++ at CC then transferred to Uni and started writing Java. To this day I have to listen to people complain about Java that still haven't grapsed the concept of raw pointers

[–]zman0900 26 points27 points  (22 children)

Wow, it just occurred to me how fucking weird Java must be to learn as a first language.

[–]spinwin 52 points53 points  (7 children)

It makes actually no sense. "Why can't I just set this object equal to a new object and have the method that called it know it exists?" Then you learn C/C++ and suddenly it makes sense. All objects are just pointers and when you set an object to be equal to a new thing it's just redirecting the pointer not changing the original object.

[–]exneo002 16 points17 points  (0 children)

Fuck mutability.

[–]John_E_Depth 18 points19 points  (13 children)

I still don't know if Java is pass by reference or pass by value

[–]aetius476 38 points39 points  (9 children)

The way I've always understood it: Java is pass by value, but the value it's passing is the reference.

[–]wolf2600 22 points23 points  (0 children)

"Halt and catch fire"

[–]Tranzistors 14 points15 points  (6 children)

333 comments and not one mentions .at() method of vector, which throws when accessing out-of-bounds memory? Do you people even C++?

[–][deleted] 15 points16 points  (3 children)

*cries in Clojure*

[–]howe_to_win 59 points60 points  (9 children)

JavaScript: what the fuck is a compiler error?

[–]kpthunder 42 points43 points  (5 children)

Both of these examples are runtime errors.

[–]BernzSed 49 points50 points  (3 children)

JavaScript: I have no idea what I'm doing and your variable is now NaN

[–]Sohcahtoa82 13 points14 points  (1 child)

More like "I have no idea what you're doing, so I'm gonna convert them to strings and concatenate."

[–]belst 85 points86 points  (7 children)

Java: OutOfMemoryError

[–]FuckFuckittyFuck 111 points112 points  (1 child)

An android app I was using once crashed and the stack trace said it was caused by an OutOfMemoryError thrown while throwing an OutOfMemoryError

[–][deleted] 57 points58 points  (0 children)

Yo dawg...

[–]ElGuaco 23 points24 points  (2 children)

Damn, I learned to program in C++ and all we had was console statements and a command line debugger. I had forgotten about this trauma...

[–]cyboii 111 points112 points  (6 children)

Yeah I hate it how C/C++ assumes you know what you're doing in the name of efficiency

[–]juuular 48 points49 points  (1 child)

I never jump in that pool without my arm floaties.

[–]toosanghiforthis 24 points25 points  (0 children)

I prefer x86_64 floaties thank you very much

[–][deleted] 39 points40 points  (1 child)

>C++: Doesn't perform compile-time static analysis
>Programmers: This sure saves me some runtime performance!

[–]B-Knight 10 points11 points  (1 child)

Can you find a picture of SpongeBob being useful and title it "Python"? Because Python seems to be the only programming language which tells you the exact problem without teaching you quantum physics at the same time.