[Opendnssec-develop] About assert()...

Matthijs Mekking matthijs at nlnetlabs.nl
Mon Feb 10 10:33:53 UTC 2014


On 02/10/2014 11:24 AM, Jerry Lundström wrote:
> On 10 Feb 2014, at 10:12 , Matthijs Mekking <matthijs at NLnetLabs.nl> wrote:
> 
>> I agree that having a lot of assertions is good practice. However, I
>> have a hard time of putting them in the right place. Below is an example
>> of where I was in doubt, and the ods_log_assert calls do not make sense
>> anymore.
> 
> If you are in doubt maybe the best way is not to use assert since it will kill the program. It is always better to provide errors that the calling code can handle.

Assertions are quite handy for in jenkins (see OPENDNSSEC-544).

In some cases they also may be useful in releases, because if the
assertion did not kill the program, a segfault probably will. If not,
something terribly wrong may happen. So sometimes dying is just the
lesser of two evils...


> 
>> In this specific case, there may be not anything useful to do for a
>> particular zone anymore, but other zones can continue to be signed.
> 
> But the asset code here will always be successful since faulty variables are handled in the code above the asserts.
> 
> With that in mind the numbers of assert we have in the code base is a bit misleading if there is a lot of cases where the asset code is like this case.
> 
> --
> Jerry Lundström - OpenDNSSEC Developer
> http://www.opendnssec.org/
> 
> 
> 
> _______________________________________________
> Opendnssec-develop mailing list
> Opendnssec-develop at lists.opendnssec.org
> https://lists.opendnssec.org/mailman/listinfo/opendnssec-develop
> 




More information about the Opendnssec-develop mailing list