This thread on Hacker News terrifies me

rikki cattermole rikki at cattermole.co.nz
Sat Sep 1 12:49:12 UTC 2018


On 02/09/2018 12:37 AM, tide wrote:
> On Saturday, 1 September 2018 at 08:18:03 UTC, Walter Bright wrote:
>> 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.
> 
> That's what he, and apparently you don't get. How are you going to use 
> an assert to check that the color of a title bar is valid? Try and 
> implement that assert, and let me know what you come up with.

If you have the ability to screenshot a window like I do, oh one simple 
method call is all that required with a simple index to get the color.

But that isn't something I'd go test... Too much system-y stuff that can 
modify it.


More information about the Digitalmars-d mailing list