pingyong
That makes no sense. If I was explaining floating point numbers with boxes, for whatever reason, I'd put the values inside the boxes, yes. The analogy just doesn't work here, but the analogy for memory makes perfect sense.
>This is an unnecessary recursivity.
No, it's not. Think of a linked list for example. Traversing it makes perfect sense with my analogy: You open the first box, look at the number that's inside, open the box corresponding to that number, look at what number is inside that box, open the next corresponding box, etc. - it all makes immediate and intuitive sense.
If you just start with "open box x" (because x you somehow already know magically because it's already in a register), you haven't really explained much.
Or think of pointers to pointers. With my analogy: Easy! It's just another box which contains the value of the next box. If this concept isn't explained, a pointer to a pointer makes no sense because the pointer value has no corresponding box, hence no address.
It's changing requirements. When you build a house, people don't come in 6 months later and ask you if you could make one small change by placing some jet engines on the walls so the house can fly somewhere else during the summer. It's just a small change, right?
The problem is that in code, it often is a small change. Or at least, it is possible to make one quick adjustment to satisfy this new use-case. But often, these small changes are also a hack which doesn't fit into the previous overall design and which would've been implemented in a completely different way had the requirement been designed for in the first place. Now, one of these "small changes" don't tend to kill the product, but years or even decades do. That's why refactoring exists in software engineering, but not really in home building. Well, in some sense it does exist by renovating. But nobody thinks it's a good idea to completely renovate a house 25 times around an architecture that just doesn't work anymore for what it's being used for.
If you build a piece of software for exactly one well specified use case and only use it for that, it'll probably run really well forever. But (almost) nobody does that.
Seems to work pretty well, at least for conveying the basic idea of pointers and dereferencing.
So, what happens if a bank goes bankrupt?
I would argue that every time you want to execute something on scope exit, that essentially models a resource or lock of some kind. Which means the constructor wouldn't be empty (it would acquire the resource), and writing the class wouldn't really be "boilerplate", it would be clean design.
>This strikes me as hijacking a memory-management facility, using it for a different purpose than its intent. That's bad for readability. I'd prefer either ScopeExit or the dummy object pattern I described.
I think it is much better for readability, because it usually models the thing you want to do much more precisely. Although it is a shame that only unique_ptr is standard and not unique_handle, but you could write that yourself relatively quickly. This case doesn't just model that you want to execute something at the end of a scope, but that you have a handle to a resource that you can std::move around and that will get destroyed at the appropriate time (if you model your data correctly).
However, a lot of people seem to be under the impression that this would boost the economy (because the idea is that almost everyone gets money so they can spend it instead of specifically helping with rent or food), which I don't think it will currently, or at least it won't in a meaningful way that helps the businesses who need it.
The problem is if you just give people money right now, they literally can't spend it on those things because they are or will be closed during that time. Money isn't the reason they're not going, Corona is.
The money would be spent on things that are doing well now anyway (rent, food and netflix/videogames/etc.).
Maybe right now the focus should be on not making people homeless, but then giving people money after the crisis so they can spend it in the industries that are suffering right now.
- doesn't terminate, doesn't have side effects -> optimization doesn't matter
- doesn't terminate, has side effects -> optimization isn't valid
- does terminate, doesn't has side effects -> optimization would be valid, but why would such a loop exist? One example that was brought up was generic code, but I'm not entirely convinced yet.
I suppose that is possible, although I'm having a hard time coming up with any reasonable examples.
This has unfortunately been my experience as well. Although in some sense I can understand it now. When only ~10k normal people per year use something, the chances of one of them trying to kill it are apparently pretty low. Although I'm still convinced at some point it is going to happen.
So in many cases, if you don't want to compromise on design and architecture, you essentially need to write the entire library twice, or at least the entire interface. Not really a great state.
>discussing "Low-cost Deterministic C++ Exceptions for Embedded Systems"
This exact reason is why I think that paper is great and also how exceptions should have been implemented in C++ in the first place.
As the writer of a library (or just other utility functions), you simply cannot know whether something is an exceptional situation or not, because that is a property of the program and the environment, not the function. Being unable to parse a string to a number, or to create a socket, or to even allocate memory can all be exceptional or not exceptional depending on the context, and often you simply do not know the context this code will run in, or the code will actually run in multiple directly contradictory contexts.
Yes, actually. Well, tax havens shouldn't be legal in the first place, but getting people with good salaries into poorer countries is good, because they pay taxes there.
Of course, the vast majority of people would actually not go to poor countries, they would simply leave cities. Which is also something that should definitely be incentivized.
If she is in high school the only answer is probably a bunch of "homework", good books on the subject, and there are also hundreds of video courses online.
But anything that does get killed by our immune system is kind of on the clock and needs to spread relatively quickly.
Well I think it needs to at least be high enough that other social spending can largely be cut (except for healthcare maybe), and that seemed like a reasonable value.
Unfortunately I can't read the link you posted since I don't have an account there.
And the reaction to it from people is quite... shortsighted? From my perspective. Often the exact people who would benefit from a better housing market vote for parties who are more restrictive in terms of new buildings. There's this perception that new buildings are only being built for "rich" people, which is true, but it also means the rich people aren't competing for your shitty apartment anymore. But somehow, people don't really think about that.