This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Have assert macros


On Wed, 25 Aug 2004, Nathan Sidwell wrote:

Zack Weinberg wrote:
but I am undecided about whether these checks ought to be off in the
release builds.

I'm not sure either, which is why I think the default should be to leave them on.

Leave them on! I heartily recommend it; we do that in Valgrind and it has saved us countless headaches -- it makes life so much easier when a user reports an assertion failure on a specified line, rather than a random crash or similar.


You do have to be a bit careful that it doesn't affect performance too much. Generally assertions check pretty simple things, though. You already have this issue with GCC's --enable-checking flag (or whatever it's called).

Balancing this is not always easy; I'd recommend having a minimum level of checking always on, ie. all assertions and some basic sanity-checking of data structures. Then have a command-line arg that asks for more thorough checking, which might be turned on for developers by default.

Just my two cents.

N


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]