[ofw] Re: [ofa-general] Issues with _osm_lin_fwd_tbl

Leonid Keller leonid at mellanox.co.il
Thu Jun 12 03:50:45 PDT 2008


One can use zero-sized arrays as a structure member, having disabled the
warning 4200.
Here is a real example from hw\mlx4\kernel\bus\core\cache.c:

	#pragma warning( disable : 4200)
	struct ib_pkey_cache {
		int             table_len;
		__be16          table[0];
	};
	#pragma warning( default  : 4200)

> -----Original Message-----
> From: ofw-bounces at lists.openfabrics.org 
> [mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of Hal Rosenstock
> Sent: Thursday, June 12, 2008 1:17 PM
> To: Sasha Khapyorsky
> Cc: ofw at lists.openfabrics.org; Vincent Ficet; 
> general at lists.openfabrics.org
> Subject: [ofw] Re: [ofa-general] Issues with _osm_lin_fwd_tbl
> 
> On Thu, 2008-06-12 at 13:00 +0300, Sasha Khapyorsky wrote:
> > On 16:51 Wed 11 Jun     , Vincent Ficet wrote:
> > >
> > > Also, could anyone explain why the osm_lin_fwd_tbl_t is 
> declared as
> > > follows:
> > >
> > > typedef struct _osm_lin_fwd_tbl {
> > >    uint16_t size;
> > >    uint8_t port_tbl[1];
> > > } osm_lin_fwd_tbl_t;
> > 
> > AFAIR the reason is a poor windows compiler which doesn't support 
> > array[0] like definitions in structures.
> 
> Yes, I too recall something being said along those lines 
> quite a while ago.
> 
> Is this accurate ? If so, is this still a restriction of the 
> Windows compilers in use (as I think the build environment 
> and perhaps the compilers have changed quite a bit since 
> then) ? Can someone knowledgeable in Windows comment on this ?
> 
> -- Hal
> 
> > Sasha
> > _______________________________________________
> > general mailing list
> > general at lists.openfabrics.org
> > http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
> > 
> > To unsubscribe, please visit 
> > http://openib.org/mailman/listinfo/openib-general
> 
> _______________________________________________
> ofw mailing list
> ofw at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw
> 



More information about the general mailing list