115 karma · joined Jun 19, 2013 (13y ago) · 69 submissions
comment 13y ago · link · parent
And if your company won't let you upgrade compilers, then it certainly won't let you switch languages altogether.
comment 13y ago · link · parent
It's just annoying when people will do anything to get on the "faster than C++" wagon.
comment 13y ago · link · parent
comment 13y ago · link · parent
What I mean to say is that Wikipedia's system is one that does not/will not give article editors credit for original content; it treats them as just collectors and explainers of original content. When the explainers start writing stuff that has no source, they then disappear and leave Wikipedia holding the content which is now unverifiable. And that's just not how Jimmy wanted it to work I guess.
When I look at it that way, the policy doesn't seem that ridiculous. It may be inconvenient, but that's like saying a stack data structure is inconvenient because you can't remove things from the bottom. It's just the way it is; it has advantages and disadvantages.
comment 13y ago · link · parent
comment 13y ago · link · parent
Glad you read the article though, now you're not going to fall for this flaw in the future.
comment 13y ago · link · parent
Not only that, but if it were the actual file on your local drive and not a link, there wouldn't be an option to "make this file available offline". There were cues which the author missed, but they were obviously not prominent enough which is a (the) design flaw.
Let this be a lesson that you should have multiple backups for anything important. I personally have 2 online backup systems and 3 local ones, the worth of which practice I learned the hard way like this author.
Also think twice before you empty the trash - you're manually making these files unrecoverable from the internet, and if your machine went up in smoke after you hit the button, you'd be screwed. That alone warrants serious consideration.
comment 13y ago · link · parent
Plus, he could have reduced lines even further to get down to about 6, like
vector<string> data;
string line;
for (ifstream ifile(argv[1]); getline(ifile, line);)
data.push_back(line);
sort(begin(data), end(data));
copy(begin(data), end(data), ostream_iterator<string>(ofstream(argv[2]), "\n"));
And his `return 0` was superfluous so I removed it.Unfortunately we work with iterator pairs in C++; if we had ranges like D does, we could turn those last two into
copy(sort(data), ...)
but alas we cannot.comment 13y ago · link · parent
1. You picked probably the most verbose way to do it.
2. It's not valid C++ because you're assigning a pointer to a value.
3. Idiomatic C++ doesn't use `new` explicitly anyway
4. The `d = {}` of Python is not really equivalent.
My feeling is that python gains brevity in exchange for putting a heavier mental load on the programmer, which is manageable for small programs but becomes unwieldy for larger ones.
comment 13y ago · link · parent
I don't know, I am similarly annoyed by mathematicians because they usually use single letters for variables. It's a little more excusable for them because math functions are usually very short and have few variables, but still I'd rather use words. But I digress.
comment 13y ago · link · parent