lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] Re: [lwip-members] minor pbuf.c changes


From: Jani Monoses
Subject: [lwip-devel] Re: [lwip-members] minor pbuf.c changes
Date: Mon, 20 Oct 2003 11:31:24 +0300

> [I've switched the discussion to lwip-devel as this might be of
> interest to more than just the CVS committers]
> 
> Regarding the asserts:  I don't have a strong opinion either way, but
> think it is good practice to check the arguments to a function and
> fail if they do not meet the specification - it allows bugs to make
> themselves evident much faster.  The asserts will only exist if you
> have done a debug compile, whereas the argument checks will exist in
> whatever build you do, so the two are similar but not equivalent.

I think asserts are for catching illegal states not ones from which a
function can return gracefully. If a function validates the input and
returns NULL in case it is not ok, then what is the need for assert? 
So imho it's worth putting an assert where when debugging it signals
something which should not have happened (and lead to crash or
corruption when not in debug mode). If it's something that is handled
anyway by the function in the normal error path than no assert is
needed...Anyway this is the case with most of lwip too where most
asserts don't have the non-debug recovery case coded.

Jani




reply via email to

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