Timeline for Tips for golfing in C++
Current License: CC BY-SA 3.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 2, 2019 at 2:58 | comment | added | Peter Cordes | But std::endl isn't "ungolfed", it's just bad style / gratuitous flushing of cout even when that's not needed. endl is the same as << '\n' plus a flush; it's a different layer of stdio that handles conversion from \n to the native platform line ending (e.g. CRLF on DOS) for text streams. If you were golfing or optimizing, you'd put the first \n into the 2nd string literal: "\nSum of evens " | |
| Dec 17, 2017 at 19:03 | history | edited | Riker | CC BY-SA 3.0 | added 35 characters in body |
| Mar 24, 2014 at 15:05 | comment | added | dmckee --- ex-moderator kitten | @MukulKumar Well, yes. But for the purposes of demonstrating this tip I left everything except the ternary-conditional un-golfed for clarity. | |
| Mar 24, 2014 at 14:01 | comment | added | Mukul Kumar | Replace std::endl with '\n' that saves 5 chars | |
| Apr 24, 2011 at 20:28 | history | answered | dmckee --- ex-moderator kitten | CC BY-SA 3.0 |