January 6, 2024
Notes on software development these days, and C++
While I mostly program in C++, pretty much everything I write targets C++98 or C++03, and completely avoids the C++ standard template library.
I have no doubt that one can write exceptionally good and safe code using C++/STL, but it also appears to be incredibly easy to write very clean and safe C++/STL code that compiles without warnings or other notice into stupidly large, inefficient, memory-intensive machine code.
People new to C++ might write something that generates a list of strings:
std::vector<std::string> list;
// populate my list with strings, suppose this is in a loop
std::string s = ...;
list.push_back(s);
then later on decide to pass this list to a function:
void dosomething(std::vector<std::string> list)
{
// does something
}
...but nobody will tell them that each call of dosomething() will execute a std::string copy constructor for each item in the list, allocating (and subsequently freeing) memory for each string. There are just so many ways to get bitten here. Yes, I know, make list 'const &' etc, but it's very easy not to know that (or somewhat less easy but still possible to forget), and multiply this by 1,000 times (I know one person who was sufficiently burned by pre-increment vs post-increment having massive performance implications that they always use pre-increment in for loops, even if it's a basic type -- not that there's anything wrong with that, I guess post-increment is an odd thing to see as normal anyway)..
And we wonder why modern software generally sucks?
Recordings:
Yes, Exactly, Yes! - 1 - Sandwich Terrier (I) -- [4:47]
Yes, Exactly, Yes! - 2 - Sandwich Terrier (II) -- [3:45]
Yes, Exactly, Yes! - 3 - Sandwich Terrier (III) -- [3:38]
Yes, Exactly, Yes! - 4 - Virgins Again (Bad at Math) -- [3:27]
Yes, Exactly, Yes! - 5 - Prelude to the River -- [7:47]
Yes, Exactly, Yes! - 6 - The River -- [4:36]
Yes, Exactly, Yes! - 7 - Vertical Integration (I) -- [5:51]
Yes, Exactly, Yes! - 8 - Vertical Integration (II) -- [5:07]
Yes, Exactly, Yes! - 9 - May 29 Track 6 -- [6:34]
Yes, Exactly, Yes! - 10 - Las Vegas -- [3:57]
Yes, Exactly, Yes! - 11 - Terms of Service -- [5:32]
Yes, Exactly, Yes! - 12 - Hindenburg -- [8:19]
Yes, Exactly, Yes! - 13 - Chosen by the Few -- [5:20]
Yes, Exactly, Yes! - 14 - Self Imposed (I) -- [7:40]
Yes, Exactly, Yes! - 15 - Self Imposed (II, slower) -- [7:23]