2,676 karma · joined Nov 28, 2019 (6y ago) · 1,131 submissions
comment 2w ago · link · parent
C++ does have many ways to do anything. Most of that is historical, or due to features and library facilities with overlapping capabilities, or inherent to multi-paradigm programming languages.
Every C++ project is written in its own language. Its own "house flavor." This is true of all languages, but is particularly stark for a language as old, complicated, and powerful as C++.
comment 3w ago · link · parent
Would you return `input.c_str()`? You might think twice about that, but it's the same thing. My favorite fix is to take a `std::string_view` as the parameter.
string_view remove_leading_spaces(string_view input) {
auto new_start = find_if(input.begin(), input.end(), [](char ch) { return ch != ' '; });
return string_view(new_start, input.end());
}
The result of the undefined behavior in your program is surprising, though. As it usually is.comment 3w ago · link · parent
comment 3w ago · link · parent
The trouble comes when you have data structures that manage memory, and you want to associate the allocation strategy with the particular instance of the data structure. Or, worse, you don't store the allocator pointer with the data and you require that all functions operating on the data structure happen to use compatible allocators.
At its simplest, though, passing allocators around is just removing an implicit global variable that is sometimes helpful to customize locally, but nearly impossible to customize locally if left as a global.
comment 3w ago · link · parent
comment 1mo ago · link · parent
> I’d like to be clear that there are legitimate uses of remote attestation. By using a website that requires attested passkeys you can be sure you stay safe from accidentally installing a scammer’s fake passkey application that steals your data – the website will reject such a passkey. You might want an attested Passkey even if the website doesn’t require it, since you can use attestation to verify that your software has not been tampered with by a hacker while you weren’t looking.
> As for reasons to not want attestation: you might want to be able to use software that Twitter (formally X) doesn’t specifically approve of, such as Linux. Or a phone with a refurbished operating system.
So the bad timeline is the one in which the industry gradually transitions to "you can't log on unless everything about your system is exactly as we want." Figures.
comment 1mo ago · link · parent
[1]: https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V...
comment 1mo ago · link · parent
I was always team "RFK Jr clearly bad," but to be honest I didn't put much work into forming that opinion.
comment 1mo ago · link · parent
Interested to hear more!
> other than an interest to interfere in US commerce on behalf of foreign entities.
No longer interested!
The article does beat around the bush and the headline is clickbait. I assumed from the title that these datacenters were not paying their bills, but instead it's about the extent to which the operators should pay for public infrastructure built due to the datacenter being built. That's an interesting question, but I don't like the goalpost begin moved from "not paying their full costs" to "not paying what I define as a 'fair share'."
comment 2mo ago · link · parent
comment 2mo ago · link · parent
comment 2mo ago · link · parent
[1]: https://www.reddit.com/r/grammar/comments/1ssrby/an_history_...