Re: arr[0] is kernel code ???

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

 



http://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
will help u and you need search google for some coding tricks or tips.


2009/4/30 Onkar <onkar.n.m@xxxxxxxxx>:
> Hi All ,
>        Why is 0 length arrays
>
> for instance
>
> struct ext2_xattr_entry {
>     __u8    e_name_len;    /* length of name */
>     __u8    e_name_index;    /* attribute name index */
>     __le16    e_value_offs;    /* offset in disk block of value */
>     __le32    e_value_block;    /* disk block attribute is stored on (n/i)
> */
>     __le32    e_value_size;    /* size of attribute value */
>     __le32    e_hash;        /* hash value of name and value */
>     char    e_name[0];    /* attribute name */
> <<<-------------------------------------------- Why ??
> };
>
> AND
>
> struct mb_cache_entry {
>     struct list_head        e_lru_list;
>     struct mb_cache            *e_cache;
>     unsigned short            e_used;
>     unsigned short            e_queued;
>     struct block_device        *e_bdev;
>     sector_t            e_block;
>     struct list_head        e_block_list;
>     struct {
>         struct list_head    o_list;
>         unsigned int        o_key;
>     } e_indexes[0]; <<<-------------------------------------------- Why ??
> };
>
>  used in many structures in the kernel code ? What is their significance ?
> and Why is
>
> do {
>  // exp 1
> //exp 2
> //exp 3
> }while (0) ;
>
> used ?
>
> Regards,
> Onkar
>
>
>
>

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