#std::cout buffer

31 messages · Page 1 of 1 (latest)

rough schooner
#

Flushing buffers and moving cursor to to the next line of the console

I'm reading this what do they mean in dummy terms?

pliant tendonBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

sinful lake
#

well let's start with perhaps the easier to understand part

#

do you understand what the Enter or Return key does on your keyboard? like when you're writing an MS Word document or an email for example?

#

also I'm assuming this thing you're reading is talking about std::endl though you haven't specifically said so

rough schooner
rough schooner
rough schooner
sinful lake
#

ok, well that seems a reasonably clear explanation to me, so I'm not sure which part you are unclear on

#

there are two separate and mostly unrelated concepts here

  1. newlines
  2. flushing
#

the explanation given there feels sufficient to me on both topics, so again, not sure which thing you need more clarity on

#

but if you need more clarity, start by separating these concepts and ask about only one of them at a time

rough schooner
sinful lake
#

it's not necessarily

#

but the rationale is usually Because Slow

#

IO in general is easily one of the slowest operations in any program on any computer

#

furthermore, systemcalls, like calls into the kernel, tend to be quite slow. so that means things like malloc() or other system calls, like system calls for IO

#

making fewer system calls for the same result is therefor faster, hopefully it's intuitive why this is true

#

are you German? your name seems German

#

I'm not sure what analogy or terms will work best for you

rough schooner
#

Woah slow down i absolutely have no idea what you are saying here you speaking advanced stuff lol.

sinful lake
#

ok the reason is "because slow"

rough schooner
sinful lake
#

great, well that's all you need to know for now

#

with one exception: "because slow" is probably not a good reason for you

#

there may or may not be some unexpected behavior if you don't use endl instead of \n

#

so I recommend most newbies use std::endl, though many people share the exact opposite view from me on this

rough schooner
sinful lake
#

or in other words: "because slow" is their reason and I don't think it's a good reason

pliant tendonBOT
#

@rough schooner Has your question been resolved? If so, run !solved :)

rough schooner
#

!solved