On Friday, 5 February 2016 at 09:50:43 UTC, Suliman wrote:
Will asserts stay after compilation in release mode?
No. The only assert that remains in release mode is assert(false)
or assert(0) as a way to identify that you've reached a piece of
code that shouldn't be executed.
On Friday, 5 February 2016 at 08:45:00 UTC, Minas Mina wrote:
Use assertions when a variable's value should not depend on
external factors.
For example, let's say you want to write a square root function.
The input must be >= 0, and because this depends on external
factors (e.g. user input), yo
On Friday, 5 February 2016 at 08:45:00 UTC, Minas Mina wrote:
On Wednesday, 14 March 2012 at 05:44:24 UTC, Chris Pons wrote:
I'm new, and trying to incorporate assert and enforce into my
program properly.
My question revolves around, the fact that assert is only
evaluated when using the debug
On Wednesday, 14 March 2012 at 05:44:24 UTC, Chris Pons wrote:
I'm new, and trying to incorporate assert and enforce into my
program properly.
My question revolves around, the fact that assert is only
evaluated when using the debug switch. I read that assert
throws a more serious exception th
On 02/05/2016 12:01 AM, Suliman wrote:
It is purely a way to make throwing an exception use a syntax similar
to assert and save a line of code.
if(!condition)
throw new Exception(msg);
becomes
enforce(condition, msg);
So enforce is just macros on top of:
if(!condition)
throw new Ex
It is purely a way to make throwing an exception use a syntax
similar to assert and save a line of code.
if(!condition)
throw new Exception(msg);
becomes
enforce(condition, msg);
So enforce is just macros on top of:
if(!condition)
throw new Exception(msg);
?
Thank you for the valuable information! The difference between
assert and enforce is now clearer in my mind.
Also, that's a great trick with enforce.
On Thursday, 15 March 2012 at 01:08:02 UTC, Jonathan M Davis
wrote:
On Wednesday, March 14, 2012 20:15:16 Spacen Jasset wrote:
Is enforce then
On Wednesday, March 14, 2012 20:15:16 Spacen Jasset wrote:
> Is enforce then a way of generating exceptions in an easier way rather
> than using some sort of "if (failure) throw" syntax? In other words, I
> assume it's a mechanism to help you use exceptions, and not some new
> semantic.
It is pure
On 14/03/2012 09:59, Dmitry Olshansky wrote:
...
To make it real simple:
- assert on stuff you know has to be true regardless of circumstances
and not dependent on any possible external factors.
- enforce on stuff that must be true, but in general can fail like "file
not found", etc. and/or depe
On 14.03.2012 9:44, Chris Pons wrote:
I'm new, and trying to incorporate assert and enforce into my program
properly.
My question revolves around, the fact that assert is only evaluated when
using the debug switch. I read that assert throws a more serious
exception than enforce does, is this cor
On Wednesday, March 14, 2012 06:44:19 Chris Pons wrote:
> I'm new, and trying to incorporate assert and enforce into my
> program properly.
>
> My question revolves around, the fact that assert is only
> evaluated when using the debug switch.
assert has nothing to do with the debug switch. All th
I'm new, and trying to incorporate assert and enforce into my
program properly.
My question revolves around, the fact that assert is only
evaluated when using the debug switch. I read that assert throws
a more serious exception than enforce does, is this correct?
I'm trying to use enforce in
12 matches
Mail list logo