Wasn't this {fmt} library merged into STL now? Does this solve this issue?
Anyways, there was also a constant that is the OS line ending without a flush, right?
Wasn't this {fmt} library merged into STL now? Does this solve this issue?
Anyways, there was also a constant that is the OS line ending without a flush, right?
If endl
is a function call and/or macro that magically knows the right line ending for whatever ultimately stores or reads the output stream, then, ugly though it is, endl
is the right thing to use.
If a language or compiler automatically "do(es) the right thing" with \n
as well, then check your local style guide. Is this your code? Do what you will. Is this for your company? Better to check what's acceptable.
If you want to guarantee a Unix line ending use \012
instead. Or \cJ
if your language is sufficiently warped.
Kinda in Java, you can call System.out.println or you can call System.out.print and explicitly write the newline.
I haven't looked at the code but I always assumed that println
was a call to print
with a new line added to the original input.
Something like this:
void print(String text) { ... }
void println(String text) { this.print(text + '\n'); }
As long as it doesn't end in ;
\n is fun until you’re an a system that needs an additional \r
Bedeviled NXP/ARM SDK stdlib. Hate it, we need \n\r there. Why????!?!?! What a PITA.
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.