Sujet : Re: Tabs As Syntax
De : OFeem1987 (at) *nospam* teleworm.us (Chris Ahlstrom)
Groupes : comp.os.linux.advocacyDate : 22. Mar 2024, 14:20:11
Autres entêtes
Organisation : None
Message-ID : <utjt1t$2tns5$1@dont-email.me>
References : 1 2 3 4 5 6
User-Agent : slrn/1.0.3 (Linux)
rbowman wrote this copyrighted missive and expects royalties:
On Thu, 21 Mar 2024 10:10:33 -0400, Chris Ahlstrom wrote:
>
for (int n : { 2, 4, 6, 8 })
std::cout << n << ", ";
std::cout << "who do we appreciate?" << std::endl
(std::endl is \n with a flush.
>
cout never did much for me either. That's one of the areas that seemed
like a gratuitous departure from C.
>
Then there is the Python
>
print("Never again!", end="\r")
operator << is useful with std::ostringstream when you want to avoid having
deal with allocating enough output space. Still, I use this a lot:
char temp[32];
snprintf(temp, sizeof temp, "We have %d idiots here", idcount);
Sometime a printf specification is just easier to read.
The GNU compiler will even warn if the buffer isn't big enough to hold
the largest possible result.
-- Gratitude and treachery are merely the two extremities of the same procession.You have seen all of it that is worth staying for when the band and the gaudyofficials have gone by. -- Mark Twain, "Pudd'nhead Wilson's Calendar"