[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 for-4.7 12/14] libxl: fix passing the type argument to xc_psr_*



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.pau@xxxxxxxxxx>
> 
> Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>

Nacked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

> > -        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@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.