[ofa-general] Re: [PATCH] libibmad: Use enum types for function parameters (WAS) Declare some enums as typedefs for cleaner function interfaces

Sasha Khapyorsky sashak at voltaire.com
Thu Feb 5 10:21:49 PST 2009


On 10:03 Thu 05 Feb     , Ira Weiny wrote:
> Sasha,
> 
> On Wed, 4 Feb 2009 10:30:54 -0800
> Ira Weiny <weiny2 at llnl.gov> wrote:
> 
> > On Wed, 4 Feb 2009 20:27:25 +0200
> > Sasha Khapyorsky <sashak at voltaire.com> wrote:
> > 
> > > On 11:20 Wed 04 Feb     , Jason Gunthorpe wrote:
> > > > On Wed, Feb 04, 2009 at 08:14:21PM +0200, Sasha Khapyorsky wrote:
> > > > 
> > > > > I don't understand how enum typedefing makes things cleaner - actually
> > > > > this will enforce me explicitly to verify an actual type in header
> > > > > files. Sometimes typedefs could help with porting, but it is not the
> > > > > case here.
> > > > 
> > > > Not typedefing per say, but passing an enum through an int is not that
> > > > great. You don't need the typedefs to do this, just 'enum MAD_FIELDS'
> > > > for instance will do.
> > > 
> > > Yes, that would be fine to do.
> > 
> > I will redo the patch with 'enum MAD_FIELDS'.
> > 
> 
> Patch below,
> Ira
> 
> From 3a52d32d7c6964a8078402c3712a58d1e43975de Mon Sep 17 00:00:00 2001
> From: weiny2 at llnl.gov <weiny2 at llnl.gov>
> Date: Mon, 2 Feb 2009 10:21:18 -0800
> Subject: [PATCH] Use enum types for function parameters
> 
> 
> Signed-off-by: weiny2 at llnl.gov <weiny2 at llnl.gov>

Applied. Thanks.

Sasha



More information about the general mailing list