Re: debugging
----- Original Message -----
From: "Carl W." <euphoria at cyreksoft.yorks.com>
> This isn't quite as informative as the C/C++ equivalent, but it serves its
> purpose...
>
> type bool(object b)
> if integer(b) and b = 1 or b = 0
> then return 1 end if return 0
> end type
>
> global bool ASSERT
> ASSERT = 1 -- set to 0 to turn assert()s off
> global type assert(bool x)
> if ASSERT then return x = 1 end if return 1
> end type
>
> with trace
>
> atom b
> integer a
>
> a = 5
> b = 2.2 * sqrt(a)
>
> trace(3) -- check the manual
>
> assert(a > b) -- passes
>
> b *= 1.1
> assert(a > b) -- fails
Here is problem that a > b expression gets evaluates if debugging is on or
off and that slows down program. even worse is if you execute expensive
debuggin function inside assert () that function is allways executed,
debugging on or off.
|
Not Categorized, Please Help
|
|