Re: what is this [0 ... n] array notation?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 17 Jan 2007, Troy Hanson wrote:

> The range initialization syntax is a GNU extension.
>
> From http://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html
>
> To initialize a range of elements to the same value, write `[first
> ... last] = value'. This is a GNU extension. For example,
>
>     int widths[] = { [0 ... 9] = 1, [10 ... 99] = 2, [100] = 3 };
>
> If the value in it has side-effects, the side-effects will happen
> only once, not for each initialized field by the range initializer.
>
> Note that the length of the array is the highest value specified
> plus one.

ah, that's the answer i was looking for, thanks.  but that's going to
cause all kinds of grief since, given that the kernel macro
SPIN_LOCK_UNLOCKED is deprecated, what's going to happen with stuff
like:

arch/sparc/lib/atomic32.c:
    [0 ... (ATOMIC_HASH_SIZE-1)] = SPIN_LOCK_UNLOCKED

since the new macro __SPIN_LOCK_UNLOCKED you're *supposed* to use
should be invoked with the name of the lock?

rday

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux