[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 01/12] libxc/save: Shrink code volume where possible
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. I think if we are going to adopt this thing in general, it ought to be in a CODING_STYLE somewhere. I'm distinctly unsure about the merits of the pattern. It does make the code much shorter and less repetitive. OTOH ?: is a not-very-frequently used GNU extension and my representative sample of programmers had to think about what this idiom meant and it wasn't universally liked. On the third hand, if this idiom becomes dominant you only have to think about it once. 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). Ian. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |