HN user

clockworkweeble

2 karma
Posts0
Comments3
View on HN
No posts found.

A couple more clarifications: the addressable 32k memory space is mapped out like an old 8-bit micro (here's a diagram I drew: https://twitter.com/weeble/status/1112527587014787082?s=19 ) and is isolated from real RAM. Code, the lua VM and heap, none of that is accessible via this address space. There's also no allocator. It's up to you to arrange data by hand in the user data region. Pretty much the worst possible consequence of a buffer overflow is stomping the graphics attributes and turning the screen into a kaleidoscope.

Given the other constraints of the system, the main place this code is likely to be used is in a script dedicated to assembling a "cartridge" file, and if the output overflows the target space (likely map or gfx ram) then it's just going to bail out with an error anyway, it's unlikely to care about the stomped-over RAM, given that it can't affect Lua variables or code.

I don't understand how the double-checked locking recommendation is safe. Someone asked about it in the comments, but the response didn't make sense to me. It seems that the call to IsLinked would introduce a data-race with adjacent deletions, and cause undefined behaviour, unless there is already locking at an outer scope. If there is such locking, the lock inside the destructor is redundant. Have I misunderstood?

It has generally been my experience that if control enters a destructor while other threads are concurrently accessing the object, you are in a world of pain. For one thing, this makes it near impossible to safely subclass the object. (Because the subclass destructor will run first, rendering its invariants invalid before the base class has done whatever it needs to do to unlink the object from the outside world.) Anecdotally, I've also found code like this to be deadlock-prone, but I couldn't say for sure if the two are causally linked.

"She must think they only asked because she's female"

Alternatively, she cannot know whether they only asked because she's female. She has to give them the benefit of the doubt, but it leaves her wondering, because it's something someone with sexist attitudes would be more likely to say. If they had chosen a more neutral topic, or presented the material in a way where it was clear that male and female candidates were treated identically, she wouldn't have been placed in that position. Her point is about how it comes across, not about how it was intended. It's more, "here's how you can avoid accidentally making candidates unsure whether you are sexist" and not "this was a sexist thing that happened".