|
From: | Hanna Reitz |
Subject: | Re: [PATCH v6 29/33] job.h: assertions in the callers of JobDriver funcion pointers |
Date: | Mon, 31 Jan 2022 09:49:14 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 |
On 28.01.22 16:19, Emanuele Giuseppe Esposito wrote:
On 26/01/2022 15:13, Hanna Reitz wrote:On 21.01.22 18:05, Emanuele Giuseppe Esposito wrote:Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> --- job.c | 9 +++++++++ 1 file changed, 9 insertions(+)Just curious, why did you remove the assertion in job_co_entry()? (Looking at it again, it might have been nicer to swap it with the assertion below it, so that `job != NULL` is asserted first, but other than that...)I think it's useless, job_co_entry runs in a coroutine in job->aio_context created and entered in job_start (its only caller), so there is no way that we are in a different aiocontext.
Well, that is what assertions are for. You don’t put them there to catch errors, you put them there to show that there’s some sort of contract the caller definitely fulfills, so that after the assertion you know this contract is fulfilled without having to read and verify what the caller does.
And perhaps also to prevent regressions when the caller code changes.
Same as assert(job), I don't think the opaque pointer can ever be NULL.
Good, because if it could, that shouldn’t be an assertion. O:)
Thank you, Emanuele(And since I’m already replying to this patch, might as well point out s/funcion/function/ in the subject) Hanna
[Prev in Thread] | Current Thread | [Next in Thread] |