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

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

 



On 1/16/07, Robert P. J. Day <rpjday@xxxxxxxxxxxxxx> wrote:
drivers/scsi/ipr.c:
        const u8 zero_sn[IPR_SERIAL_NUM_LEN] = { [0 ... IPR_SERIAL_NUM_LEN-1] = '0' };

where does this "..." range syntax come from?  i know gcc supports the
*case* range extension, but i don't know where the above *arrray*
range syntax comes from.

just like it looks ... instead of  writing '0' IPR_SERIAL_NUM_LEN
times, gcc will fill it for you

this:
#define IPR_SERIAL_NUM_LEN 5
{ [0 ... IPR_SERIAL_NUM_LEN - 1] = '0' }
is an easier way to write:
{ '0', '0', '0', '0', '0' }
-mike

--
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