This thread on Hacker News terrifies me

tide tide at tide.tide
Sat Sep 1 02:28:58 UTC 2018


On Friday, 31 August 2018 at 22:05:18 UTC, H. S. Teoh wrote:
> On Fri, Aug 31, 2018 at 09:40:50PM +0000, tide via 
> Digitalmars-d wrote:
>> On Friday, 31 August 2018 at 21:31:02 UTC, 0xEAB wrote:
> [...]
>> > Furthermore, how often have we cursed about games that hung 
>> > up with a blackscreen and didn't let us close them by any 
>> > mean other than logging off? If they just crashed, we'd not 
>> > have run into such problems.
>> 
>> That's assuming an assert catches every error. Not all bugs 
>> are going to be caught by an assert. I don't think I've ever 
>> had a game hung up in a black screen and not be able to close 
>> it.
>
> I have, and that's only one of the better possible scenarios.  
> I've had games get into a bad state, which becomes obvious as 
> visual glitches, and then proceed to silently and subtly 
> corrupt the save file so that on next startup all progress is 
> lost.
>
> Had the darned thing aborted at the first visual glitch or 
> unexpected internal state, instead of blindly barging on 
> pretending that visual glitches are not a real problem, the 
> save file might have still been salvageable.
>
> (Yes, visual glitches, in and of themselves, aren't a big deal.
>  Most people may not even notice them.  But when they happen 
> unexpectedly, they can be a symptom of a deeper, far more 
> serious problem. Just like an assert detecting that some 
> variable isn't the expected value. Maybe the variable isn't 
> even anything important; maybe it just controls the color of 
> the title bar or something equally irrelevant. But it could be 
> a sign that there's been a memory corruption.  It could be a 
> sign that the program is in the middle of being exploited by a 
> security hack. The unexpected value in the variable isn't 
> merely an irrelevant thing that we can safely ignore; it could 
> be circumstantial evidence of something far more serious.  
> Continuing to barrel forward in spite of clear evidence 
> pointing to a problem is utterly foolish.)
>
>
> T

I'm just wondering but how would you code an assert to ensure the 
variable for a title bar is the correct color? Just how many 
asserts are you going to have in your real-time game that can be 
expected to run at 144+ fps ?


More information about the Digitalmars-d mailing list