Re: [ILUG] gcc optimisation weirdness?

From: Justin Mason (jm at domain jmason.org)
Date: Wed 10 May 2000 - 17:56:35 IST


"Kenn Humborg" said:

> > PS: is there anyway to initialise an array at declaration time, rather
> > than iterate thru the array and set each element manually? eg something
> > like: int array[9]=0;
>
> You mean like:
>
> int array[9]={0, 1, 2, 3, 4, 3, 2, 1, 0};
>
> That is standard C. GCC also has some extensions that allow
> you to do fancied stuff with initializers. Take a look at
> the C and C++ Extensions sections in the GCC info pages.

Or use memset();

  memset ((void *) array, 0, sizeof(array));

--j.



This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:06:05 GMT