Skip to content
DevMeme
6070 of 7435
C++ Code with Painfully Verbose and Redundant Comments
CodeQuality Post #6647, on Apr 15, 2025 in TG

C++ Code with Painfully Verbose and Redundant Comments

Why is this CodeQuality meme funny?

Level 1: Explaining the Obvious

Imagine you're reading a short story, and after every single word, the storyteller stops to explain what that word means. For example:

"The (a word we use for something specific) cat (a small furry animal) sat (which means it was sitting down) on the mat (a small rug)."

By the time you get through that sentence, you've probably forgotten what it was about! It’s overkill, right? It makes the story confusing and no fun to read. This meme’s code did exactly that, but with computer instructions. The programmer wrote a little explanation for every little thing in the code, even parts that were already really clear. It’s like labeling a picture of an apple with the word “apple” on every leaf and stem, or telling someone “I’m going to open the door (the wooden thing that lets you go out) now.”

The reason this is funny is because it’s so unnecessary. Explaining everything actually makes it harder to understand the overall idea, just like over-explaining a joke would ruin the joke. Normally, when we write code (or tell a story), we only explain the parts that might be tricky or not obvious. If you explain the obvious stuff, you end up burying the real meaning in a pile of needless details. So seeing code where the person did that to an extreme is humorous — it’s a silly example of what not to do. It reminds us that sometimes trying too hard to help (by over-explaining) can have the opposite effect, making things more confusing. In simple terms, it’s funny because the coder is playing "Captain Obvious," telling us things we already know, and that overly literal approach just looks absurd in a place where we expect clear, no-nonsense instructions.

Level 2: Less Comment, More Clarity

In programming, code comments are notes written for humans that the computer ignores. They’re usually used to explain something non-obvious about the code. In C++, you can write comments in two ways:

  • // This is a single-line comment.
  • /* This is a block comment that can span multiple lines or appear inline. */

The meme shows C++ code where the programmer used the block comment style /* ... */ in-line, wrapping almost every piece of the code with a tiny explanation. Normally, comments like this are meant to clarify complex logic or provide context. But here they’re describing every step, even the obvious ones. This is called over-commenting – adding so many comments (or such trivial comments) that instead of making the code clearer, it actually makes it harder to read. It’s a bit like a storybook where after each sentence, the author inserts another sentence explaining the first one. Pretty soon, the actual story is lost in a sea of explanations.

Let’s break down what the code in the meme is doing (beneath all the commentary): It defines a function API::initCurl(). Inside, the code calls curl_easy_init() – a function from the libcurl library that tries to initialize a CURL handle for making HTTP requests. The result of curl_easy_init() is stored in a variable (likely CURL* handle). Then there’s an if (!handle) check, which in plain English means “if the handle is null (i.e., if initialization failed)”. If that condition is true, the code prints an error message curl couldnt init and returns from the function. In a normal scenario, that’s a straightforward sequence:

  1. Initialize a resource (the curl handle).
  2. Check if it succeeded.
  3. If not, log an error and exit early.

That logic by itself is very common and clear to anyone with basic C/C++ knowledge. Usually, we might add one comment at most, something like // Initialize curl and verify it worked. In well-written code, even that might be unnecessary if the code is self-explanatory. For example, a clean version of this code might look like:

CURL* handle = curl_easy_init();  // initialize a CURL handle for HTTP requests
if (!handle) {
    printf("curl couldn't init"); // print error if initialization failed
    return;                       // exit early if no handle
}
// ... proceed with using the handle if it's valid ...

Now compare that to the meme version, where the same concepts are broken into many tiny comments:

/*the variable*/ handle /*is*/ = /*to the result of the function named*/ curl_easy_init();

In that line, the author is literally narrating what the code does in fragments. They intended to form an English sentence: “the variable handle is equal to the result of the function named curl_easy_init().” It’s true, that is what the code does – but any programmer can see that without the comment. By inserting those explanations inline, the code becomes hard to read. You have to jump over the comment text in your mind to piece together the actual code. The comment text is superfluous, a fancy word for “unnecessary.” It’s not adding any new understanding; it’s just stating the obvious in a clunky way.

This is a classic code readability issue. CodeQuality isn’t just about making code work – it’s also about making code easy for humans to understand and maintain. When there’s a comment on every token, the clarity drops. The reader’s eye has to filter out a lot of noise to get to the real logic. It’s like trying to read a sentence where someone has stuck a definition after every word – very distracting! The term inline_comment_noise (as tagged) really captures it: the inline comments create so much noise that the signal (the actual code) is hard to follow.

Let’s clarify some terms and best practices that this meme brings up:

  • Self-documenting code: Code written in a way that it explains itself. This means using meaningful variable and function names, and clear logic. If you have a variable named totalPrice, you typically don’t need a comment saying // total price of items – the name already tells you that. Self-documenting code reduces the need for many comments.

  • Comment the “why”, not the “what”: A common guideline is that comments should explain the intention or reasons behind code, rather than restating what the code does. For example, a good comment might be, “// using a binary search here for efficiency (O(log n) lookup)” – it tells why we chose this approach. A bad comment would be, “// call binarySearch function” on a line that literally calls binarySearch(). We can see that it’s calling the function; we don’t need the comment to repeat it. In the meme’s code, comments like /*and then*/ return /*nothing*/; are telling us what return; does, which is obvious to any C++ developer (a return; in a void function just returns). No “why” or extra insight is given, so those comments aren’t helpful.

  • Code smell: This is a term for any pattern in code that signals a potential problem. Over-commenting is often considered a code smell. It doesn’t mean the program won’t run, but it’s a hint that the coder might have misunderstood how to communicate intent or that the code might not be well-structured. Usually, if you feel the need to write a comment for every line, it might indicate the code isn’t written clearly. The preferable solution is to refactor the code or rename things so it’s clearer, rather than plastering comments everywhere.

  • Maintainability: Code is read and modified in the future (often by other people or your future self). Excessive comments can hurt maintainability. Why? If the code changes, each of those comments has to change too, or else they become misleading. It’s extra work and very error-prone. Real projects often have style guides that say things like “comments should be kept up-to-date or removed if they become inaccurate.” With a comment on every token, keeping them up-to-date is nearly impossible. It’s very likely something will be forgotten. Then you have code that says one thing and a comment that says another – which can confuse developers and lead to bugs.

Many beginners go through a phase of writing comments for everything, especially if they’ve been taught that in school or tutorials. For instance, you might remember writing something like:

int sum = a + b; // adding a and b to get their sum

Early on, that seems helpful to prove you know what’s happening. But as you gain experience, you realize the code sum = a + b; speaks for itself (assuming a and b have descriptive names). The comment “// adding a and b” doesn’t tell a professional anything they didn’t already see from the code. It actually just adds clutter. In a code review, a teammate might gently suggest removing such a comment. They’re not against comments altogether – they just want to keep the code clean and focused. Instead of commenting every trivial line, seasoned devs comment only when necessary. Perhaps something like:

int sum = a + b; // combine scores from player A and player B

Here the comment provides context that these aren’t just any numbers, but specific “scores from players” which might not be obvious from a and b alone. That’s a meaningful comment. The rule of thumb is: comments should add understanding. If they’re just repeating the code in plain English, they can be left out.

The meme’s code is a funny exaggeration of what happens when someone doesn’t follow this principle. It literally comments on every little thing, even the punctuation! This is why it’s tagged as DocumentationHumor and CodingHumor – it takes a real issue (too many comments) and blows it up to absurd levels for a laugh. Any developer who’s spent time trying to improve code readability will look at this and chuckle, “yeah, this would drive me crazy.” And if you’re new to coding, the takeaway is: you don’t need to annotate every single token in your program. It’s better to write clear code and use comments sparingly to explain the non-obvious parts. This will make your code cleaner, easier to read, and easier to maintain. After all, code is a form of communication – you want to communicate your intent without overwhelming your reader. In documentation, as in code, sometimes less is more.

Level 3: All Comment, No Code

This meme screenshot shows a C++ function absolutely drowning in comments. Every token – from the return type to the braces – is wrapped in a /* ... */ remark, turning a simple libcurl initialization into a tangled verbose mess. The rainbow syntax highlighting in the IDE is overwhelmed by a flood of pale-green text fragments, making the actual logic as hard to pick out as a needle in a haystack. It’s a perfect lampoon of the overzealous documentation anti-pattern: the code is so busy explaining itself that it forgets to just be readable. Seasoned engineers recognize this as a readability crime on sight.

As the title suggests, it’s like Clean Code principles collided head-on with over-documentation. Ironically, Clean Code (the famous book by Robert C. Martin) preaches almost the opposite of what we see here: it advocates for self-documenting code where clear naming and simple structures reduce the need for comments. In Clean Code, comments are seen as a last resort or a deodorant for smelly code – they’re useful only when the code truly needs extra explanation. Here, however, someone took the idea of “document your code” way too literally. We have an English narrative woven through the code via inline comments, defeating the purpose of writing clean, self-explanatory code.

For a senior developer, the humor (and horror) comes from how familiar this scenario feels – albeit in exaggerated form. We’ve all encountered code where comments state the obvious, but this takes it to another level. It’s beyond normal over-commenting; it’s commenting every single token. The result is pure comment noise. You can barely see the actual program logic hidden behind the commentary. Imagine being on-call at 3 AM, opening this file and trying to quickly grasp what it does – you’d be slogging through a wall of green text explaining that return; “returns nothing”. 🙄 It’s funny because it’s a nightmare we pray to never see outside of a joke.

Take a closer look at one example from the snippet:

/*the variable*/ handle /*is*/ = /*to the result of the function named*/ curl_easy_init();

This single line is a tour de force of redundant commenting. The code itself (handle = curl_easy_init();) is straightforward – it calls curl_easy_init() (a libcurl function that initializes a CURL handle) and stores the result in handle. But the comments turn it into a clunky sentence: “the variable handle is = to the result of the function named curl_easy_init()”. Every piece of the statement is painstakingly spelled out in English, yet we gain no new insight. It’s superfluous documentation at its finest. In fact, the extra verbiage makes it harder to spot that we’re simply assigning a handle. This kind of needless explanation is what we call noise: it drowns out the signal of the actual code.

Another gem from the code is the if condition:

if /*the*/ (!handle) /*isn't*/ {
    /*then*/ printf(/*the string:*/ "curl couldnt init");
    /*and then*/ return /*nothing*/;
}

The developer seemingly wanted to narrate the logic: “if the handle isn’t (valid), then print... and then return nothing.” But by slicing that narration into a dozen inline comments, they’ve made the if (!handle) check harder to read than it would be with zero comments. A reader has to mentally reassemble “if the ... isn’t” around the actual code (!handle). It’s the opposite of clarity. CodeReview wisdom says that comments should clarify tricky intent, not spell out basic syntax. Here the intent was already crystal clear – if (!handle) means “if handle is null (i.e., curl init failed)”. Wrapping it in commentary actually introduces confusion where there was none.

Why do experienced devs find this hilarious (or cringe-worthy)? Because it exaggerates a well-known code smell: commenting things that don’t need to be commented. It’s a parody of novice practices. In the real world, any sensible code-review rubric or style guide would flag this immediately. You’d see review comments like: “Remove redundant comment,” or “This comment just restates the code.” In fact, many teams have rules against this. It’s universally understood that needless explanations harm CodeQuality – they clutter the code and can even become misleading if the code changes later. If someone ever updated the logic but not the comments (a very common scenario), those comments would turn into lies. Maintaining a codebase like this would be a nightmare: you’d have to update a comment on every other token whenever you refactor!

There’s also an element of shared developer trauma being mocked here. A lot of us were taught in school or by outdated guides to “comment thoroughly.” Perhaps the poor soul who wrote this code thought they were doing the right thing – maybe their first boss or a misinformed tutorial told them more comments = better code. This meme cranks that idea up to absurdity: What if someone literally documented every tiny piece of the code? The result would fail any real-world CodeReadability standard, but it perfectly creates a comedic effect. It’s basically DocumentationHumor: the joke is that writing comments should improve understanding, yet here it obliterates it.

In summary, the meme is funny to developers because it highlights a well-known truth by showing its bizarro opposite. Good code documentation is about quality, not quantity. When taken to this extreme, commenting every token reads like a parody of code documentation – one that would make any veteran dev either laugh out loud or shudder (or both). It’s a reminder that sometimes less is more in code. The best comments are like salt: a little bit brings out the flavor, but too much can ruin the dish. Here, we’ve got a salt shaker emptied onto the code, and the result is jarringly inedible – which is exactly why it’s so amusing to anyone who’s ever done a code review.

Description

This image is a screenshot of a code snippet, likely C or C++, displayed in a dark-themed editor. The function shown, `initCurl`, is simple: it initializes a cURL handle and performs a basic null check. However, the code is excessively commented to an absurd degree. Every keyword, variable, operator, and function call is surrounded by a C-style block comment (`/* ... */`) that describes the syntax in plain English. For example, the line `handle = curl_easy_init();` is written as `/*the variable*/ handle /*is*/ = /*to the result of the function named*/ curl_easy_init();`. The humor stems from the complete misunderstanding of what comments are for. Instead of explaining the 'why' or the business logic, the comments painstakingly narrate the syntax itself, making the code incredibly difficult to read and maintain. This is a perfect example of poor code quality and bad documentation, resonating with experienced developers who have encountered similar, albeit less extreme, examples of useless comments in legacy codebases or from junior programmers

Comments

22
Anonymous ★ Top Pick This is what happens when you ask an AI to 'comment this C++ code' and it charges by the word
  1. Anonymous ★ Top Pick

    This is what happens when you ask an AI to 'comment this C++ code' and it charges by the word

  2. Anonymous

    At 800 comments per LOC, the cyclomatic complexity is technically negative - the compiler tapped out after chapter two

  3. Anonymous

    This is what happens when management demands '100% code documentation coverage' and you maliciously comply - even the semicolons need their own architectural decision records and threat models

  4. Anonymous

    This is what happens when you take 'self-documenting code' too literally - every token gets its own narrative arc. The developer clearly misunderstood the advice to 'comment your code' and instead wrote a choose-your-own-adventure novel where the protagonist is a CURL handle. At this rate, the comments have more cyclomatic complexity than the actual logic, and code reviews will require a literature degree. It's the software equivalent of explaining a joke while telling it - by the time you reach the punchline (the actual function call), everyone's already left the room

  5. Anonymous

    curl_easy_init(): C's polite reminder that even 'easy' init hoists error handling onto your shoulders - or NULL

  6. Anonymous

    Achieved 300% comment-to-code ratio: every token is annotated, yet nobody knows who owns the curl handle, why we’re calling printf in C++, or what the retry/cleanup strategy is

  7. Anonymous

    We let an LLM 'self‑document' the C++ cURL wrapper - cognitive load is now O(tokens) and the only error handling is printf('curl couldnt init')

  8. @TERASKULL 1y

    code should be self documenting:

  9. @learner_beginner 1y

    When they found the C++ code extremely hard and asked for an explanation

  10. @loomingsorrowdescent 1y

    1Ass-ass code

  11. @azizhakberdiev 1y

    what my colleagues want me to do when they ask code to be more readable

  12. @douglas_adams 1y

    # Narrative Code Commentator Prompt You are an expert code-to-English translator. Your primary task is to transform code into natural English text by strategically inserting explanatory comments. The goal is that when reading the code WITH the comments together, it should form coherent, readable English sentences. ## Your Objective Transform ordinary code into narrative code where comments and code elements together create a flowing English explanation of what the code does. ## Comment Styling Rules 1. Use the format `//*comment text*/` for all comments 2. Position comments immediately before the code element they describe 3. Comments should complete sentences when read with the following code element 4. Use different colors for different types of elements: - Function/purpose descriptions in green - Variable explanations in teal/cyan - Conditional logic in yellowish-green - Flow control statements in purple/magenta - Technical terms or API identifiers in white/highlighted - Error messages or important strings in red-orange ## Comment Content Guidelines 1. Break down each line into logical components 2. Comments should explicitly identify: - Function purposes (e.g., `//*function in the class*/`) - Variable roles (e.g., `//*the variable*/`) - Conditional explanations (e.g., `//*the*/`, `//*isn't*/`) - Action consequences (e.g., `//*then*/`, `//*and then*/`) - Return value meanings (e.g., `//*nothing*/`) 3. When you add comments, ensure they create complete sentences with the code that follows 4. Use natural, conversational language that explains the code's purpose 5. Cover ALL parts of the code to create a comprehensive narrative ## Example Transformation **Original Code:** """ void initCurl() { handle = curl_easy_init(); if (!handle) { printf("curl couldnt init"); return; } } """ **Transformed Narrative Code:** """ //*a*/ void //*function in the class that will*/ initCurl() { //*the variable*/ handle //*is*/ = //*to the result of the function named*/ curl_easy_init(); if //*the*/ (!handle) //*isn't valid*/ { //*then*/ printf(//*the string:*/ "curl couldnt init"); //*and then*/ return //*nothing*/; } } """ When reading the comments and code together, this creates natural English sentences: - "a void function in the class that will initCurl()" - "the variable handle is = to the result of the function named curl_easy_init()" - "if the (!handle) isn't valid" - "then printf(the string: 'curl couldnt init')" - "and then return nothing" ## Important Reminder The comments + code MUST flow as natural English when read together, while preserving the original code's functionality. Every part of the code should have an appropriate comment that helps create this narrative flow.

  13. @TheRamenDutchman 1y

    What I did when I learned coding and knew I'd look at it again after a few months of hiatus

  14. @graduated_vernier 1y

    Future comment for me: /* good luck */

    1. @learner_beginner 1y

      At the beginning only God and I knew what I was doing but now only God knows

      1. @qtsmolcat 1y

        Bold of you to think God wants anything to do with that trainwreck

        1. @azizhakberdiev 1y

          well, sometimes I pray and it works

    2. @Broken_Cloud_1 1y

      telegram thinks this is c code 😇

      1. @TheRamenDutchman 1y

        Yeah well it's also C code

        1. @RiedleroD 1y

          craziest piece of polyglot code ever written

  15. @dan_homer 1y

    if /*the*/ (! handle) /*isn't*/ if (!!handle)???

    1. @callofvoid0 1y

      is

Use J and K for navigation