On 14/01/2020 16:48, Ian Jackson wrote: > Andrew Cooper writes ("[PATCH 01/12] libxc/save: Shrink code volume where > possible"): >> A property of how the error handling (0 on success, nonzero otherwise) >> allows these calls to be chained together with the ternary operatior. > I'm quite surprised to find a suggestion like this coming from you in > particular.
What probably is relevant is that ?: is a common construct in the hypervisor, which I suppose does colour my expectation of people knowing exactly what it means and how it behaves. > Maybe it would be better to have > #define MUST(call) ({ rc = (call); if (rc) goto error; }) > and write > MUST( write_one_vcpu_basic(ctx, i) ); > > Or just to permit > rc = write_one_vcpu_basic(ctx, i); if (rc) goto error; > (ie on a single line). OTOH, it should come as no surprise that I'd rather drop this patch entirely than go with these alternatives, both of which detract from code clarity. The former for hiding control flow, and the latter for being atypical layout which unnecessary cognitive load to follow. ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel