86thumbs
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Hellfire103@lemmy.ca to Programmer Humor@lemmy.mlEnglish · 7 个月前

Does this exist anywhere outside of C++?

lemmy.ml

message-square
62
fedilink
  • cross-posted to:
  • programmer_humor@programming.dev
171

Does this exist anywhere outside of C++?

lemmy.ml

Hellfire103@lemmy.ca to Programmer Humor@lemmy.mlEnglish · 7 个月前
message-square
62
fedilink
  • cross-posted to:
  • programmer_humor@programming.dev
  • unlawfulbooger@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    17
    ·
    7 个月前

    What the heck is endl???

    • vapeloki@lemmy.world
      link
      fedilink
      arrow-up
      40
      arrow-down
      1
      ·
      7 个月前

      std::endl is used in output streams in C++ to end the line, using the os specific line termination sequence, and flush the buffer.

      The later one is a performance issue in many cases, why the use of "\n" is considered preferred

      • xigoi@lemmy.sdf.org
        link
        fedilink
        English
        arrow-up
        3
        arrow-down
        1
        ·
        7 个月前

        Don’t most terminals flush the buffer on newline anyway?

        • ClemaX@lemm.ee
          link
          fedilink
          arrow-up
          9
          arrow-down
          1
          ·
          7 个月前

          It is the stream itself that is buffered, so the terminal does not handle the contents until the stream is flushed.

        • vapeloki@lemmy.world
          link
          fedilink
          arrow-up
          2
          ·
          7 个月前

          Maybe, but there is the internal buffer. Also, most I/O happens in files not consoles

    • Hellfire103@lemmy.caOP
      link
      fedilink
      English
      arrow-up
      10
      ·
      edit-2
      7 个月前

      Instead of this:

      cout << "Hello world.\n";
      

      You can do this:

      cout << "Hello world." << endl;
      
      • Daedskin@lemm.ee
        link
        fedilink
        arrow-up
        6
        ·
        6 个月前

        The fact that you used the namespace for cout but not for endl inordinately bothers me

      • ReversalHatchery@beehaw.org
        link
        fedilink
        English
        arrow-up
        1
        ·
        7 个月前

        something has replaced your lessthan signs with their HTML counterparts. such a silly thing to do in a code block

        • fubbernuckin@lemmy.dbzer0.com
          link
          fedilink
          English
          arrow-up
          3
          ·
          7 个月前

          I think that’s client side. Doesn’t happen for me.

          • Cyberfishofant2@lemm.ee
            link
            fedilink
            English
            arrow-up
            1
            ·
            6 个月前

            same here. AP isn’t standardized enough, apparently

            • ReversalHatchery@beehaw.org
              link
              fedilink
              English
              arrow-up
              1
              ·
              edit-2
              6 个月前

              nah its a lemmy app on android that didn’t get an update in ages. probably just uses a faulty markdown renderer

    • gon [he]@lemm.ee
      link
      fedilink
      English
      arrow-up
      7
      ·
      7 个月前

      https://cplusplus.com/reference/ostream/endl/

      • unlawfulbooger@lemmy.blahaj.zone
        link
        fedilink
        arrow-up
        12
        arrow-down
        1
        ·
        7 个月前

        Boy am I glad I don’t do C++ anymore. That string handling with the overloaded bitshift operator was wild.

        • vext01@lemmy.sdf.org
          link
          fedilink
          arrow-up
          1
          ·
          7 个月前

          Ah, so you’re a println! kinda guy?

          • unlawfulbooger@lemmy.blahaj.zone
            link
            fedilink
            arrow-up
            2
            ·
            6 个月前

            🦀 🦀🦀🦀🦀🦀🦀🦀

      • SqueakyBeaver@lemmy.blahaj.zone
        link
        fedilink
        arrow-up
        2
        ·
        6 个月前

        Alternatively:

        https://en.cppreference.com/w/cpp/io/manip/endl

        p.s. The site isn’t entirely mobile friendly

        (I’m a cppref lover tbh)

    • allywilson@lemmy.ml
      link
      fedilink
      arrow-up
      3
      ·
      7 个月前

      From memory it’s a way to declare a line ending after your string.

    • jaybone@lemmy.zip
      link
      fedilink
      English
      arrow-up
      2
      ·
      7 个月前

      God bless your soul.

Programmer Humor@lemmy.ml

programmerhumor@lemmy.ml

remote_follow_modal_title

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.
community_visibility: public
globe

public_blurb

  • 110 users / day
  • 712 users / week
  • 2.13K users / month
  • 7.82K users / 6 months
  • number_of_local_subscribers
  • 38.7K subscribers
  • 1.87K Posts
  • 39.2K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.ml
  • cat_programmer@lemmy.ml
  • UI: unknown version
  • BE: 0.19.5
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org