eviltoast
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
hairinmybellybutt@lemmy.world to Programmer Humor@lemmy.mlEnglish · 2 years ago

advanced

lemmy.world

message-square
16
link
fedilink
164

advanced

lemmy.world

hairinmybellybutt@lemmy.world to Programmer Humor@lemmy.mlEnglish · 2 years ago
message-square
16
link
fedilink
alert-triangle
You must log in or # to comment.
  • lobsticle 🦞@lemmy.world
    link
    fedilink
    arrow-up
    30
    ·
    2 years ago

    Very disappointing not to see an #if 0 (my personal go-to for decades) in this meme. 😞

    • SpaceNoodle@lemmy.world
      link
      fedilink
      arrow-up
      11
      ·
      2 years ago

      Damn, you beat me to it.

      It’s common enough that it’s supported like a comment by numerous syntax highlighting schemes, and has the added benefits of guaranteeing that the code won’t be compiled as well as encapsulating any pre-existing block comments. Conversely, if (false) is total garbage.

    • AlmightySnoo 🐢🇮🇱🇺🇦@lemmy.world
      link
      fedilink
      arrow-up
      5
      arrow-down
      1
      ·
      2 years ago

      beat me to it too, it’s a meme of course but the advantage compared to comments is thay you get syntax highlighting 😁

    • Magister@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      2 years ago

      this is what I’m doing too, so at least it’s not compiled and better than a /* */ as you can keep all the code intact in your #if 0

  • 👍Maximum Derek👍@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    22
    ·
    2 years ago

    I was going through some js code a few months ago and every function in a module had return; as its first line. And that module was imported into 4 or 5 scripts.

  • AlmightySnoo 🐢🇮🇱🇺🇦@lemmy.world
    link
    fedilink
    arrow-up
    15
    arrow-down
    1
    ·
    2 years ago

    laughing in #if 0:

    #include 
    
    int main()
    {
    #if 0
            std::cout << "Look at this" << std::endl;
    #else
            std::cout << "ugly abomination." << std::endl;
    #endif
    }
    
  • xmunk@sh.itjust.works
    link
    fedilink
    arrow-up
    6
    ·
    2 years ago

    If you’re in a language that supports it, please don’t use if (false) use if ($disallowAllUsers = false && $whateverTheRealConditionIs)

    • PlexSheep@feddit.de
      link
      fedilink
      arrow-up
      4
      ·
      2 years ago

      Never seen this, what language or buildsystem is this?

      • xmunk@sh.itjust.works
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        2 years ago

        That specific language is PHP, but the tip is applicable in any language that supports inline assignment.

        • The Octonaut@mander.xyz
          link
          fedilink
          arrow-up
          3
          ·
          2 years ago
          if (true === $wantToCauseErrorsForFun) {
              badOldFunction();
          } 
          
  • Jupy@linux.community
    link
    fedilink
    English
    arrow-up
    4
    ·
    2 years ago

    You folks have clearly not met first year CS students. Screenshots code

  • katy ✨@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    3
    ·
    2 years ago

    bonus points if you use a different variable every file so they have to go through and change every instance if they want to make changes

  • FiskFisk33@startrek.website
    link
    fedilink
    arrow-up
    2
    ·
    2 years ago

    what about relying on the persistent undo history in vim?

  • Bankenstein@feddit.de
    link
    fedilink
    arrow-up
    2
    ·
    2 years ago

    [Ctrl-V]69jI// [Esc]

    • murtaza64@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      2 years ago

      gc69j

  • Archpawn@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    2 years ago

    In Python you put it in a multiline string, since it has those but not multiline comments.

  • Kbin_space_program@kbin.social
    link
    fedilink
    arrow-up
    1
    ·
    2 years ago

    deleted by creator

Programmer Humor@lemmy.ml

programmerhumor@lemmy.ml

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmerhumor@lemmy.ml

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 16 users / day
  • 937 users / week
  • 2.11K users / month
  • 5.98K users / 6 months
  • 26 local subscribers
  • 41.3K subscribers
  • 1.94K Posts
  • 31.5K Comments
  • Modlog
  • mods:
  • cat_programmer@lemmy.ml
  • AgreeableLandscape@lemmy.ml
  • BE: 0.19.15
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org