Cult I Mean Group
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Hellfire103@lemmy.ca to Programmer Humor@lemmy.mlEnglish · 1 year ago

Does this exist anywhere outside of C++?

lemmy.ml

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

Does this exist anywhere outside of C++?

lemmy.ml

Hellfire103@lemmy.ca to Programmer Humor@lemmy.mlEnglish · 1 year ago
message-square
63
fedilink
  • cross-posted to:
  • programmer_humor@programming.dev
  • Oriel Jutty :hhHHHAAAH:@infosec.exchange
    link
    fedilink
    arrow-up
    36
    arrow-down
    3
    ·
    1 year 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
      49
      ·
      1 year ago

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

    • SpaceNoodle@lemmy.world
      link
      fedilink
      arrow-up
      7
      ·
      1 year 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 year 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 year ago

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

          • AnyOldName3@lemmy.world
            link
            fedilink
            arrow-up
            4
            ·
            1 year 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.

  • 16 users / day
  • 833 users / week
  • 2.2K users / month
  • 5.94K users / 6 months
  • 1 local subscriber
  • 41.5K subscribers
  • 1.98K Posts
  • 37.3K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.ml
  • cat_programmer@lemmy.ml
  • BE: 0.19.8
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org