Re: [PATCH 3/4] per-platform IA64_{FIRST,LAST}_DEVICE_VECTOR definitions

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

 



On Wed, 21 Dec 2005 12:32:20 -0700, 
Matthew Wilcox <[email protected]> wrote:
>On Wed, Dec 21, 2005 at 01:18:43PM -0600, Mark Maule wrote:
>> Ok.  Was just following the lead of this:
>> 
>> static struct msi_desc* msi_desc[NR_IRQS] = { [0 ... NR_IRQS-1] = NULL };
>> 
>> So arrays are always init'd to zero?
>
>Static variables without an initialiser go to the bss section and get
>initialised to 0 by the loader.  So the initialisation above is
>redundant on all machines which use a bitpattern of zeros to represent
>the NULL pointer.  Which is all machines Linux runs on.

Semi off topic nit pick.  C99 standard, section 6.7.8, note 10.

"... If an object that has static storage duration is not initialized
explicitly, then:

â?? if it has pointer type, it is initialized to a null pointer;
â?? if it has arithmetic type, it is initialized to (positive or
  unsigned) zero;
â?? if it is an aggregate, every member is initialized (recursively)
  according to these rules;
â?? if it is a union, the ï¬?rst named member is initialized
  (recursively) according to these rules."

On the off chance that Linux is ever implemented on a machine that does
not use zeroes for a NULL pointer, it would be the compiler's job to
correctly initialise a pointer or array of pointers.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux