Wei Liu writes ("Re: [PATCH v2 for-4.7 12/14] libxl: fix passing the type 
argument to xc_psr_*"):
> On Tue, Apr 26, 2016 at 04:52:21PM +0200, Roger Pau Monne wrote:
> > The xc_psr_* functions expect the type to be xc_psr_cat_type instead of
> > libxl_psr_cbm_type, so do the conversion.
> > 
> > Signed-off-by: Roger Pau Monné <roger....@citrix.com>
> 
> Acked-by: Wei Liu <wei.l...@citrix.com>

Nacked-by: Ian Jackson <ian.jack...@eu.citrix.com>

> > -        if (xc_psr_cat_set_domain_data(ctx->xch, domid, type, socketid,
 cbm)) {
> > +        if (xc_psr_cat_set_domain_data(ctx->xch, domid, (xc_psr_cat_typ
e)type,
> > +                                       socketid, cbm)) {

I'm very much against introducing casts which are not absolutely
necessary.  Casts are a big hammer which can suppress important
warnings (such as conversions between integers and pointers).

This anomaly with the same enum defined in two places with two names
is pretty poor.  But if we are to perpetuate it, as perhaps we must,
then rather than casting at each conversion point, we should introduce
an inline function which contains the cast.  That way each call site
remains more typesafe.

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to