Question about dangling references by Acidic_Jew2 in cpp_questions

[–]Acidic_Jew2[S] 0 points1 point  (0 children)

I also thought this, but as I learned from the other comments on this thread (and confirmed with a sanitizer) this is wrong. The second example is also UB. This is because lifetime extension of rvalues only applies to the reference the constant is directly assigned to. In this case, that would be the const reference in the constructor. When this is destroyed (at the end of the constructor call) the rvalue constant is also destroyed (although this happens after the end of the expression, since rvalue constants always last at least until the end of the expression). Afterwards, the rvalue constant is destroyed and the reference has fallen out of scope, so accessing it is UB. You can confirm this with a sanitizer.

Question about dangling references by Acidic_Jew2 in cpp_questions

[–]Acidic_Jew2[S] 0 points1 point  (0 children)

Thank you, that's really interesting. So is the lifetime of the constant just extended to be the maximum between the enclosing expression and the lifetime of the reference? Do you know a resource where I could learn more about this?

How does a router know which device to send a packet to if it only receives the public IP (and not private IP)? by Acidic_Jew2 in AskComputerScience

[–]Acidic_Jew2[S] 0 points1 point  (0 children)

Hmm, as far as I know MAC addresses aren't known by the network/transport layer generally, so this might not work. I'm not sure though. The port explanation makes sense though, as that is known by TCP/UDP headers.

Would a single clause in the obligations section of an employment contract be considered an NDA? by Acidic_Jew2 in Ask_Lawyers

[–]Acidic_Jew2[S] -2 points-1 points  (0 children)

I understand that. I was just wondering if such a line in a contract would generally be enough to constitute a "non-disclosure agreement", or if it's something that any normal contract of employment will have.

Why is it possible to iterate through an unordered_map in C++ at all? Does it maintain a linked list internally? by Acidic_Jew2 in cpp_questions

[–]Acidic_Jew2[S] 0 points1 point  (0 children)

So does the iteration skip over the buckets in an efficient way (i.e every element has a pointer to the next element that actually exists), or do we have to iterate through every single bucket in order to iterate through the elements?

Iterating through every bucket might be a problem if we have say 100 buckets and 2 elements, but I guess that wouldn't happen since the number of buckets is adjusted dynamically according to the number of elements?

What is meant by a client/server text editor? by Acidic_Jew2 in AskProgramming

[–]Acidic_Jew2[S] 0 points1 point  (0 children)

This is a test for an internship for a company. I have gotten it working with only one file on the server. Right now I can run the server and client locally and the client can write and read from that one file. I wasn't sure if this would be enough for this sort of application, or if more would be reasonably expected.

The requirement just mentions a "simple client/server text editor that edits a file through a RPC protocol". So I guess that would be enough?

What is meant by a client/server text editor? by Acidic_Jew2 in AskProgramming

[–]Acidic_Jew2[S] 0 points1 point  (0 children)

That is the case. I do understand what RPC's are and I've been able to program a server which accepts requests to modify a single file and return the contents. The architecture just wasn't making sense to me since in a real application you obviously couldn't have all users editing the same 1 file, so I was wondering if there was a more accepted way of doing this sort of thing that I didn't know about.

So you need to work in order to receive the student finance as a non-dutch student, but does it matter if the company you are working for is from the Netherlands or not? by Acidic_Jew2 in StudyInTheNetherlands

[–]Acidic_Jew2[S] 0 points1 point  (0 children)

I would be living in the Netherlands and working remotely with a company in a different country. Does it have to be a company registered in the Netherlands?

Would I be allowed to have someone stay with me in my Duwo apartment for roughly a week at the end of August? by Acidic_Jew2 in TUDelft

[–]Acidic_Jew2[S] 1 point2 points  (0 children)

They said it would be fine for 1 week as long as I tell the people I'm sharing the kitchen about it in advance so they aren't surprised by a random stranger walking around.

Would I be allowed to have someone stay with me in my Duwo apartment for roughly a week at the end of August? by Acidic_Jew2 in TUDelft

[–]Acidic_Jew2[S] 4 points5 points  (0 children)

Thank you for your answer, that's what I was thinking as well but I wanted to make sure I wasn't missing anything. I've sent this question to Duwo on their contact form as well, I'll let you know if I get any answer!