Re: structure for Super IO chip detection

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

 



On Fri, Nov 19, 2010 at 12:27 PM, hiren panchasara
<hiren.panchasara@xxxxxxxxx> wrote:
> You should be able to find how structures are declared/defined/used in any
> good C programming book.
I doubt if such a thing is mentioned on any good C book.
Coming to OP's question.You need to know to understand this is that,
in C/C++, if you initialise part of an array or struct, i.e. supply
fewer initialisation values than there are elements, then the
remainder of the elements in the array/struct are initialised to 0.
So, in this case, if you just initialise the first element to 0, then
you are effectively initialising all elements to 0. This is what's
happening in the example above, except that it's an array of structs,
hence the double { }
superios[NR_SUPERIOS] = { { 0 } };
The code should not have been done
superios[NR_SUPERIOS] = { { 0 ,}, };
These commas are redundant and all compilers will not support it.

-- 
http://mightydreams.blogspot.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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