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

Re: [Xen-devel] [PATCH v1 08/10] libxl: introduce libxl_get_memory_static_max



Ian Campbell writes ("Re: [PATCH v1 08/10] libxl: introduce 
libxl_get_memory_static_max"):
> On Thu, 2014-07-17 at 13:02 +0100, Wei Liu wrote:
> > On Thu, Jul 17, 2014 at 11:47:08AM +0100, Ian Campbell wrote:
> > > It looks to me like this could instead be a common helper function, with
> > > a simple boolean parameter.
> > 
> > Ian J likes macro while you likes functions. I'm fine with anything that
> > works. :-)
> 
> I think Ian prefers macros over repetition, but not at the expense of a
> helper function. IOW macros only when the function is impossible. At
> least I hope that's the case!

Yes.  I am indeed allergic to repetition.  Repetition should be
avoided by the use of helper functions if possible; or helper
functions with helper macros; or failing that just macros; or failing
that with code autogeneration run from the build system.

So I agree with Ian C that if you can shrink the proportion of the
code in the macros that's probably a good thing, unless it seems to
break things up so much it makes them more confusing.

Note also that there are complicated rules about pointer casting -
particularly about calling a function through a pointer which has been
cast from one function pointer type to another.

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®.