Ian Jackson writes ("Re: [PATCH 01/12] libxc/save: Shrink code volume where 
possible"):
> 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) );

This is not uncommon.  BIND9 does something like it:
    
https://git.uis.cam.ac.uk/x/uis/ipreg/bind9.git/blob/HEAD:/lib/dns/zone.c#l515

A friend points out that
  #define MUST(x) ({ int rc_ = (x); if (rc_) { rc = rc_; goto error; } })
is better because it keeps rc uninitialised until the last moment.
That means the compiler can spot exit paths where you fail to set rc.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to