Skip to content
DevMeme
3641 of 7435
The Worst Possible C++ in Java Integration
Languages Post #3979, on Nov 27, 2021 in TG

The Worst Possible C++ in Java Integration

Description

This meme uses the three-panel 'Captain America in an Elevator' format to tell a classic programmer dad joke. In the first panel, Captain America, looking serious, states, 'I use c++ in java'. In the second panel, a skeptical character (Jasper Sitwell) demands, 'Show me,' which is followed by a small inset showing a snippet of Java code: a for loop that reads 'for (int c = 0; c < 10; c++) { System.out.println(c++); }'. The final panel shows Captain America being choked and attacked by everyone else in the elevator. The humor is a play on words: the expectation is a complex integration using the Java Native Interface (JNI) to run C++ code, but the reality is a literal, syntactical 'c++' (the variable 'c' being incremented) inside a Java for loop. The violent reaction is an exaggeration of the groan-worthy nature of the pun, a relatable feeling for any senior developer who has endured enough terrible tech jokes

Comments

11
Anonymous ★ Top Pick He's lucky they didn't ask to see his JNI bindings; that would have been a real horror scene
  1. Anonymous ★ Top Pick

    He's lucky they didn't ask to see his JNI bindings; that would have been a real horror scene

  2. Anonymous

    Told the architects I’d “integrated C++ into our Java service”; once they saw println(c++), the JNI talk ended and we spent the rest of the meeting tracing why every second invoice vanished

  3. Anonymous

    After 20 years of explaining that '++' is just an operator inherited from C, not an embedded C++ compiler, I've started telling juniors that Java's real superpower is supporting C#'s null-coalescing operator through creative use of NPEs

  4. Anonymous

    The real crime isn't using C++ syntax in Java - it's that `System.out.println(c++)` will print the value *before* incrementing, making the loop output 0-9 instead of 1-10, which means this developer doesn't fully understand either language's post-increment semantics. Senior engineers know the most dangerous code isn't the syntax error that fails at compile time, but the semantically valid abomination that passes code review and ships to production

  5. Anonymous

    “I use C++ in Java” - for(int c=0;c<10;c++) println(c++); The only optimization that halves your logs and doubles your code review comments

  6. Anonymous

    Using c++ in both println and the loop update is the fastest way to get even numbers - and odd comments - on your PR

  7. Anonymous

    JNI without the native crash: just increment a string literal and call it polyglot mastery

  8. @bommelhopser 4y

    Double Increment. So 5 lines printed

    1. Max Ting 4y

      Wow

  9. @justjonniejoy 4y

    I call the Police

  10. Deleted Account 4y

    Madman

Use J and K for navigation