Jellie Frontier
  • 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
23
fedilink
115
external-link

Does this exist anywhere outside of C++?

lemmy.ml

Hellfire103@lemmy.ca to Programmer Humor@lemmy.mlEnglish · 3 months ago
message-square
23
fedilink
  • unlawfulbooger@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    15
    ·
    3 months ago

    What the heck is endl???

    • vapeloki@lemmy.world
      link
      fedilink
      arrow-up
      30
      ·
      3 months ago

      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

    • Hellfire103@lemmy.caOP
      link
      fedilink
      English
      arrow-up
      11
      ·
      edit-2
      3 months ago

      Instead of this:

      cout << "Hello world.\n";
      

      You can do this:

      cout << "Hello world." << endl;
      
      • Daedskin@lemm.ee
        link
        fedilink
        arrow-up
        6
        ·
        3 months ago

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

    • gon [he]@lemm.ee
      link
      fedilink
      English
      arrow-up
      5
      ·
      3 months ago

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

      • unlawfulbooger@lemmy.blahaj.zone
        link
        fedilink
        arrow-up
        5
        arrow-down
        1
        ·
        3 months ago

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

      • SqueakyBeaver@lemmy.blahaj.zone
        link
        fedilink
        arrow-up
        2
        ·
        3 months ago

        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
      ·
      3 months ago

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

    • jaybone@lemmy.zip
      link
      fedilink
      English
      arrow-up
      2
      ·
      3 months ago

      God bless your soul.

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.

  • 114 users / day
  • 543 users / week
  • 1.77K users / month
  • 6.23K users / 6 months
  • 1 local subscriber
  • 36.9K subscribers
  • 643 Posts
  • 2.11K Comments
  • Modlog
  • mods:
  • cat_programmer@lemmy.ml
  • BE: 0.19.8
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org