On Saturday, September 1, 2018 6:37:13 AM MDT tide via Digitalmars-d 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.
I don't think that H. S. Teoh's point was so much that you should be asserting anything about the colors in the graphics but rather that problems in the graphics could be a sign of a deeper, more critical problem and that as such the fact that there are graphical glitches is not necessary innocuous. However, presumably, if you're going to put assertions in that code, you'd assert things about the actual logic that seems critical and not anything about the colors or whatnot - though if the graphical problems would be a sign of a deeper problem, then the assertions could then prevent the graphical problems, since the program would be killed before they happened due to the assertions about the core logic failing. - Jonathan M Davis