gnutls-devel
[Top][All Lists]
Advanced

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

Re: GNUTLS_ASSERT macro


From: Nikos Mavrogiannopoulos
Subject: Re: GNUTLS_ASSERT macro
Date: Fri, 26 Nov 2010 18:19:16 +0100

On Fri, Nov 26, 2010 at 4:08 PM, Jeffrey Walton <address@hidden> wrote:
> Hi All,
> A properly asserted program expedites finding the point of first
> failure in a program or library. I believe the current GnuTLS assert
> could be improved.

gnutls_assert() is not related to the use of assert(). The name might
be confusing, but it's already there. We use gnutls_assert() to get an
easy backtrace of a program that fails without going through the debugger.

There is run-time functionality to enable assertions and print information
on them.

> Typically, and application or library is built with either a "debug"
> configuration, or a "release" configuration. The current assert is
> gnutls_assert(), which does nothing when DEBUG is defined.

It's not related to how assert() works.

> GnuTLS should probably honor the intent of standard assert() and
> provide equivalent behavior: if NDEBUG is defined, asserts are not
> compiled into the program code. Otherwise, asserts are compiled into
> the program code [1].

No. The original assert() is very dangerous, and pretty useless to me.
Projects that need assertions why wouldn't they use them in production
code? The cost of the instructions of the "if" is pretty low to even
consider it.

regards,
Nikos



reply via email to

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