[ofa-general] Re: [PATCH 2/6] [ib-diag] ibroute: add support for WinOF

Jason Gunthorpe jgunthorpe at obsidianresearch.com
Thu Feb 26 13:30:33 PST 2009


On Thu, Feb 26, 2009 at 11:02:19PM +0200, Sasha Khapyorsky wrote:

> > -		size = mk_reply(attr, mad + IB_VENDOR_RANGE2_DATA_OFFS,
> > +		size = mk_reply(attr, (char *) mad + IB_VENDOR_RANGE2_DATA_OFFS,
> 
> What is the reason for such void * to char * casting?

Math on void* pointers is a gcc extension, I'm surprised you don't get
warnings on linux - it is worth figuring out how to turn those on..

Sean: For this purpose casting to (char *) is somewhat sketchy, it
should be (uint8_t *).. char should only ever be used for strings due
to possible troubles with environments using 16 bit chars for wide
character support.

Jason



More information about the general mailing list