Neo Mujico
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Hellfire103@lemmy.ca to Programmer Humor@lemmy.mlEnglish · 3 months ago

Does this exist anywhere outside of C++?

lemmy.ml

external-link
message-square
14
fedilink
1
external-link

Does this exist anywhere outside of C++?

lemmy.ml

Hellfire103@lemmy.ca to Programmer Humor@lemmy.mlEnglish · 3 months ago
message-square
14
fedilink
alert-triangle
You must log in or register to comment.
  • jecxjo@midwest.social
    link
    fedilink
    English
    arrow-up
    0
    ·
    3 months ago

    They aren’t the same thing so the comparison is weird.

    endl has a flush which is important when doing something like embedded work or RTOS development. If i was doing multiple lines they all were \n until the last line when i actually want to push the buffer.

    Obviously depending on the tuning of the compiler’s optimization multiple flushes could be reduced but the goal should always be to write as optimal as possible.

    • aport@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      3 months ago

      Who in the hell is using iostreams in an RTOS

      • jecxjo@midwest.social
        link
        fedilink
        English
        arrow-up
        0
        ·
        3 months ago

        Sometimes you work in a codebase that was decided on by others for reasons you don’t know.

  • RandomVideos@programming.dev
    cake
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    Endl is faster to type

  • SpaceNoodle@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    3 months ago

    If I’m writing C++, I’m usually optimizing for portability over performance, in which case I would prefer std::endl as it would yield the best results regardless of platform; it also keeps the end-of-line character out of other strings, making code just a little cleaner.

    \n is for when I’m done pretending that anything that isn’t Unix-like is OK, or I’m counting the cycles of every branch instruction.

  • lnxtx (xe/xem/xyr)@feddit.nl
    link
    fedilink
    English
    arrow-up
    0
    ·
    3 months ago

    Rebel side \0

  • besselj@lemmy.ca
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    \r\n gang

    • aport@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      3 months ago

      Are you a modem by any chance?

    • SpaceNoodle@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      3 months ago

      Get out

  • GideonBear@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    #define endl “\n”

  • lengau@midwest.social
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    os.linesep

    Lol jk none of my stuff runs on Windows anyway

  • bramen49@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    Well, Java has System.lineSeparator so, maybe no?

  • nope@jlai.lu
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    Environment.NewLine might exist in C#

    • HiddenLayer555@lemmy.ml
      link
      fedilink
      English
      arrow-up
      0
      ·
      3 months ago

      Microsoft really creating the problem and then forcing you to use their solution.

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.

  • 2 users / day
  • 9 users / week
  • 84 users / month
  • 379 users / 6 months
  • 0 local subscribers
  • 36.9K subscribers
  • 991 Posts
  • 3.57K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.ml
  • cat_programmer@lemmy.ml
  • BE: 0.19.8
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org