mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@clusterfs.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Jesper Juhl <juhl-lkml@dif.dk>,
	linux-kernel@vger.kernel.org, akpm@osdl.org
Subject: Re: Any reason why we don't initialize all members of struct Xgt_desc_struct in doublefault.c ?
Date: Fri, 26 Nov 2004 13:24:31 -0700	[thread overview]
Message-ID: <20041126202431.GL23661@schnapps.adilger.int> (raw)
In-Reply-To: <41A7483F.9010302@pobox.com>

[-- Attachment #1: Type: text/plain, Size: 1027 bytes --]

On Nov 26, 2004  10:14 -0500, Jeff Garzik wrote:
> Jesper Juhl wrote:
> >Yes, this is nitpicking, but I just can't leave small corners like this 
> >unpolished ;)
> >
> >in arch/i386/kernel/doublefault.c you will find this (line 20) :
> >
> >struct Xgt_desc_struct gdt_desc = {0, 0};
> >
> >but, struct Xgt_desc_struct has 3 members, 
> >
> >struct Xgt_desc_struct {
> >        unsigned short size;
> >        unsigned long address __attribute__((packed));
> >        unsigned short pad;
> >} __attribute__ ((packed));
> >
> >so why only initialize two of them explicitly?
> 
> 'pad' is a dummy variable... nobody cares about its value.

Also, for struct initializations if you don't specify a field explicitly
it will be initialized to zero anyways, so even "gdt_desc = { }" is enough
in this case to initialize all of the fields to zero.

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://members.shaw.ca/adilger/             http://members.shaw.ca/golinux/


[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

      parent reply	other threads:[~2004-11-26 20:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-24 23:21 Jesper Juhl
2004-11-25 16:45 ` Zwane Mwaikambo
2004-11-26 15:14 ` Jeff Garzik
2004-11-26 15:24   ` Jesper Juhl
2004-11-26 20:24   ` Andreas Dilger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041126202431.GL23661@schnapps.adilger.int \
    --to=adilger@clusterfs.com \
    --cc=akpm@osdl.org \
    --cc=jgarzik@pobox.com \
    --cc=juhl-lkml@dif.dk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®