This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: static initialization of an array
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Massimiliano Cialdi <cialdi at firenze dot net>
- Cc: linux c programming <linux-c-programming at vger dot kernel dot org>, gcc <gcc at gcc dot gnu dot org>
- Date: Mon, 21 Jan 2002 17:01:40 +0100
- Subject: Re: static initialization of an array
- References: <36DD5B06.7080600@firenze.net>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Mar 03, 1999 at 04:53:42PM +0100, Massimiliano Cialdi wrote:
> I use gcc 3.0.3
> I must initialize a fixed size (but a priori unknow) array.
> In assembler there is DUP which let to initialize a memory area with
> some value.
> There is something similar in C?
Not in ISO C, GCC has an extension where you can initialize a range:
#define SIZE 256
int foo [SIZE] = { [ 1 ... SIZE - 32 ] = 52, [ SIZE - 1 ] = 74 };
See gcc documentation.
Jakub