Discover
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Hellfire103@lemmy.ca to Programmer Humor@lemmy.mlEnglish · 1 month ago

Does this exist anywhere outside of C++?

lemmy.ml

message-square
63
link
fedilink
  • cross-posted to:
  • programmer_humor@programming.dev
172

Does this exist anywhere outside of C++?

lemmy.ml

Hellfire103@lemmy.ca to Programmer Humor@lemmy.mlEnglish · 1 month ago
message-square
63
link
fedilink
  • cross-posted to:
  • programmer_humor@programming.dev
  • Oriel Jutty :hhHHHAAAH:@infosec.exchange
    link
    fedilink
    arrow-up
    36
    ·
    1 month ago

    std::endl provides zero portability benefits. C++ does have a portable newline abstraction, but it is called \n, not endl.

    • Albbi@lemmy.ca
      link
      fedilink
      arrow-up
      48
      ·
      1 month ago

      Thank you two for demonstrating the image in the post so well.

    • SpaceNoodle@lemmy.world
      link
      fedilink
      arrow-up
      7
      ·
      1 month ago

      No, there’s no guarantee that in every context \n is translated portably.

      • Oriel Jutty :hhHHHAAAH:@infosec.exchange
        link
        fedilink
        arrow-up
        15
        ·
        1 month ago

        The same is true of std::endl. std::endl is simply defined as << '\n' << std::flush; nothing more, nothing less. In all cases where endl gives you a “properly translated” newline, so does \n.

        • SpaceNoodle@lemmy.world
          link
          fedilink
          arrow-up
          7
          ·
          1 month ago

          Ahhh, I see. Looks like the magic happens somewhere further down in iostream.

          • AnyOldName3@lemmy.world
            link
            fedilink
            arrow-up
            4
            ·
            1 month ago

            It’s controlled by whether the stream’s opened in text mode or binary mode. On Unix, they’re the same, but on Windows, text mode has line ending conversion.

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.

  • 147 users / day
  • 1.27K users / week
  • 2.41K users / month
  • 9.69K users / 6 months
  • 1 local subscriber
  • 35.7K subscribers
  • 1.52K Posts
  • 25.6K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.ml
  • cat_programmer@lemmy.ml
  • BE: 0.19.11
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org