octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: assert() taking long time


From: John W. Eaton
Subject: Re: assert() taking long time
Date: Thu, 19 Sep 2013 10:54:42 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12

On 09/19/2013 10:13 AM, Jordi GutiƩrrez Hermoso wrote:
On Thu, 2013-09-19 at 09:35 +0200, Daniel Kraft wrote:

In C/C++, one can easily disable assertions using the preprocessor.  I
think it would be great if Octave could provide a similar feature, where
asserts could be executed or ignored depending on a switch similar to
debug_on_error and all those options.

I like this idea. Looking forward to your patch. :-)

- Jordi G. H.



Not so fast, eh?

In Octave, assert is a function just like any other. It is perfectly valid for you to write a class that has an assert function, or to replace the default assert function with your own. I suspect the overhead of calling assert is primarily about executing the code that makes up the argument to the assert function, then looking up the appropriate function to call. Further, assert may be a variable name. So you can't just have the parser detect a symbol with the name assert and blindly turn it into a no-op.

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]