Re: [ANNOUNCE] GIT 1.0.7

From: H. Peter Anvin <hpa@zytor.com>
Date: 2006-01-08 07:47:06
Junio C Hamano wrote:
> 
> Here is what I am planning to merge into the master/maint.  The
> patch is for maint which does not ship with describe, but the
> problematic path[] can be updated to path[FLEX_ARRAY] as others
> when merging it to the master branch.
> 
> -- >8 --
> Subject: [PATCH] Compilation: zero-length array declaration.
> 
> ISO C99 (and GCC 3.x or later) lets you write a flexible array
> at the end of a structure, like this:
> 
> 	struct frotz {
> 		int xyzzy;
> 		char nitfol[]; /* more */
> 	};
> 
> GCC 2.95 lets you to do this with "char nitfol[0]";
> unfortunately this is not allowed by ISO C90.
> 
> This declares such construct like this:
> 
> 	struct frotz {
> 		int xyzzy;
> 		char nitfol[FLEX_ARRAY]; /* more */
> 	};
> 
> and git-compat-util.h defines FLEX_ARRAY to 0 for gcc 2.95 and
> empty for others.
> 
> Although I have not tried this myself, if you are using a C90 C
> compiler, you should be able to override this with
> CFLAGS=-DFLEX_ARRAY=1 from the command line of "make".
> 

Any reason to not just do:

  	struct frotz {
  		int xyzzy;
  		char nitfol[1]; /* more */
  	};

... which should work on all compilers?

	-hpa
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Sun Jan 08 07:50:19 2006

This archive was generated by hypermail 2.1.8 : 2006-01-08 07:50:27 EST