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

War Crimes

lemmy.world

message-square
37
link
fedilink
741

War Crimes

lemmy.world

Shady_Shiroe@lemmy.world to Programmer Humor@lemmy.ml · 2 years ago
message-square
37
link
fedilink
alert-triangle
You must log in or register to comment.
  • fri@compuverse.uk
    link
    fedilink
    arrow-up
    91
    ·
    edit-2
    2 years ago

    Looks like it creates a few emoji printers in a vector, then prints them all. The output is all emoji, of course. The main function exits with a random return value just to be more quirky.

    I’m not sure what the purpose of the 😎 function is. In main that first predicate is always true, so it prints the poop emoji. I don’t know why it’s behind an if.

    Also, there’s a copy-paste error on line 31. Wrong emoji is used.

    • randomuser38529@lemmy.world
      link
      fedilink
      arrow-up
      30
      ·
      2 years ago

      This guy emotes ᕦ(ò_óˇ)ᕤ

  • SouthernCanadian@sh.itjust.works
    link
    fedilink
    arrow-up
    51
    arrow-down
    1
    ·
    2 years ago

    Wow that’s horrible. They’re using c++.

    • zib@kbin.social
      link
      fedilink
      arrow-up
      33
      ·
      2 years ago

      If you really need some nightmare fuel, some of us use c++ every day and even enjoy it.

      • pwalker
        link
        fedilink
        arrow-up
        3
        ·
        2 years ago

        it’s hard to believe…

  • erogenouswarzone@lemmy.ml
    link
    fedilink
    arrow-up
    39
    arrow-down
    2
    ·
    edit-2
    2 years ago

    It would be great to use some emojis in coding.

    Imagine how much more readable it would be if you could break a loop with 💀 or return true with 👍. Or use ❓for ifs, or ↔️ for switch (the emoji didn’t work for that one). Or use an emoji to represent a custom object?

    Maybe the ECMA should get on that!

    Edit: I guess you can use emojis for custom objects in js.

    Edit 2: ➡ for console.log

    • SubArcticTundra@lemmy.ml
      link
      fedilink
      arrow-up
      8
      ·
      2 years ago

      You’d still be left with the brackets and braces though. It might make more sense in a whitespace-based language pike Python

      • erogenouswarzone@lemmy.ml
        link
        fedilink
        arrow-up
        6
        arrow-down
        1
        ·
        2 years ago

        I see your point. Personally, I like the brackets and braces, they help organize. Or maybe that’s just what I’m used to.

    • jimmux@programming.dev
      link
      fedilink
      arrow-up
      3
      arrow-down
      1
      ·
      2 years ago

      Programming typefaces with ligatures are a step in this direction.

      I would try this in something like Haskell, where some of the more exotic character sequences get tricky to recognise.

      Unison might be the best language to test this in. Having identifiers separate from the actual definitions, you can call anything whatever you want.

    • aard@kyu.de
      link
      fedilink
      arrow-up
      2
      ·
      2 years ago

      emacs lisp already lets you use the full range of unicode.

      • erogenouswarzone@lemmy.ml
        link
        fedilink
        arrow-up
        1
        ·
        2 years ago

        Sorry, I meant ECMAScript

    • HxD@mastodon.sdf.org
      link
      fedilink
      arrow-up
      1
      ·
      2 years ago

      @erogenouswarzone
      https://github.com/StavromulaBeta/emoji-apl
      @Shady_Shiroe

  • balance_sheet@lemmy.world
    link
    fedilink
    arrow-up
    20
    ·
    edit-2
    2 years ago

    deleted by creator

  • magic_lobster_party@kbin.social
    link
    fedilink
    arrow-up
    18
    ·
    edit-2
    2 years ago

    💩
    🍊
    🍉
    🍉
    🍍
    🍎

  • sznio@lemmy.world
    link
    fedilink
    arrow-up
    18
    arrow-down
    1
    ·
    2 years ago

    Surprisingly more readable than standard C++

  • RagnarokOnline@reddthat.com
    link
    fedilink
    arrow-up
    15
    ·
    2 years ago

    I didn’t bother trying to see what an output would be, but this is a nightmare.

    • Rai@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      2
      ·
      2 years ago

      Oh no, now I’m going to notice you in, like, every thread!

      • RagnarokOnline@reddthat.com
        link
        fedilink
        arrow-up
        2
        ·
        2 years ago

        Hahaha, I’m inevitable! The nostalgia is too powerful!

  • ArtisinalBS@lemm.ee
    link
    fedilink
    arrow-up
    11
    ·
    2 years ago

    Is 👀 even defined?

    • CaptainJack42
      link
      fedilink
      arrow-up
      15
      ·
      2 years ago

      Yes, line 28 defines 🍴which defines 👀 and all the structs inherit from 🍴

      • jasondj@ttrpg.network
        link
        fedilink
        arrow-up
        10
        ·
        2 years ago

        Brand new sentence.

  • nothacking
    link
    fedilink
    arrow-up
    11
    ·
    edit-2
    2 years ago

    This just prints:

    💩
    🍊
    🍉
    🍉
    🍍
    🍎
    

    Line 38 and 39 just check if a function that always returns false is false and if so, prints “💩\n”. (C++ uses the bit shift operator for file IO for some reason)

    Line 41 creates a vector of shared pointers to an abstract class, or in other words, an array of functions. Each function prints the emoji, mostly the same as the name, but not always. ( 🍒 is the exception, it prints “🍉\n”)

    43 and 44 just loop over the array and call every function inside, printing a bunch of emoji.

    Line 46 returns the result of std::rand(), but because the programer forgot to call srand, the result is always the same (1804289383 for me).

    (There are also a few missing includes, but I doubt this is intentional)

  • Zuberi 👀@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    10
    ·
    2 years ago

    Genius honestly

  • kspatlas@artemis.camp
    link
    fedilink
    arrow-up
    10
    ·
    2 years ago

    https://esolangs.org/wiki/Emoji

  • flashgnash@lemm.ee
    link
    fedilink
    arrow-up
    10
    ·
    2 years ago

    Now imagine the poor sod who gets this as an interview question

    “Please extend the following code in the same code style to sort [😀,😃,😄,😁,😆] using bubble sort”

  • xigoi@lemmy.sdf.org
    link
    fedilink
    arrow-up
    7
    ·
    2 years ago

    http://emojicode.org/

    • balance_sheet@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      2 years ago

      deleted by creator

  • SpeakinTelnet@sh.itjust.works
    link
    fedilink
    arrow-up
    6
    ·
    2 years ago

    Mojo prepared me for this with their filename extension .🔥

  • heimchen
    link
    fedilink
    arrow-up
    5
    ·
    2 years ago

    Assembly but the commands are emojies🤯

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.

  • 273 users / day
  • 677 users / week
  • 1.71K users / month
  • 10.3K users / 6 months
  • 802 local subscribers
  • 35.6K subscribers
  • 1.71K Posts
  • 37.8K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.ml
  • cat_programmer@lemmy.ml
  • BE: 0.19.11
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org