Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
>  > Gilles Chanteperdrix wrote:
>  > > bheap_destroy allow
>  > > setting the bheap_t structure to an invalid value which, in turn, allow
>  > > helping upper layers in catching invalid uses of the bheap after its
>  > > destruction.
>  > 
>  > Ok, we could make bheap_destroy pop up under XENO_OPT_DEBUG. We may then
>  > also add assertions to the bheap functions themselves to check for
>  > invalid usage.
> 
> The checkings are already there, if you do not remove
> bheap_destroy. They are unconditionnal, because I find such checkings way
> too important to be optimized out.

Sorry, I might be blind, but how do bheap_gethead, bheap_insert, or
bheap_delete detect that heap->last or heap->sz became 0 after
bheap_destroy?

Given that this is code to be inlined and heavily used, we should really
take care for size and efficiency on production systems, even if it's
about a few bytes here. But I also agree that verbose(!) checking
(XENO_ASSERT/XENO_BUGON) is very useful during development.

Jan

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to