[ofa-general] Re: [PATCH] libibmad: Declare some enums as typedefs for cleaner function interfaces

Sasha Khapyorsky sashak at voltaire.com
Wed Feb 4 11:29:14 PST 2009


On 10:30 Wed 04 Feb     , Ira Weiny 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.
> 
> Yes, this will force you to use the correct type.

Not "typedef" will do it, but proper prototypes.

> Again, I am trying to write a library which makes it easier for someone who
> might not be familiar with IB to extract diagnostic data. I understand you
> wanting the decoding of the data to be more flexible and abstract but we should
> make the interface for decoding that data easier to use.  I feel the following
> patch does this.
> 
> Would you prefer to use:
> 
> uint32_t mad_get_field(void *buf, int base_offs, enum MAD_FIELDS field);
> 
> ?

Yes, this would be correct and clear.

Sasha



More information about the general mailing list