On 7/30/2014 8:09 PM, Tofu Ninja wrote:
When is the appropriate time to use an assert? If an assert should not be used on input, then any thing that can't be statically known is considered an input and anything that is derived from an input is also an input... so when can we use an assert? The only things left it seems are things know at compile time and at that point what is the the point of having assert when we have static assert...
Asserts are used to verify the logic of your code is correct: x = y + y; assert(x == 2 * y);