This thread on Hacker News terrifies me

Walter Bright newshound2 at digitalmars.com
Sat Sep 1 08:18:03 UTC 2018


On 8/31/2018 7:28 PM, tide wrote:
> 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 ?

Experience will guide you on where to put the asserts.

But really, just apply common sense. It's not just for software. If you're a 
physicist, and your calculations come up with a negative mass, you screwed up. 
If you're a mechanical engineer, and calculate a force of billion pounds from 
dropping a piano, you screwed up. If you're an accountant, and calculate that 
you owe a million dollars in taxes on a thousand dollars of income, you screwed 
up. If you build a diagnostic X-ray machine, and the control software computes a 
lethal dose to administer, you screwed up.

Apply common sense and assert on unreasonable results, because your code is broken.


More information about the Digitalmars-d mailing list