From: Aaron Cripps <acripps@gmail.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] setting fops member pointers to NULL?
Date: Tue, 29 May 2007 10:13:13 +0000 [thread overview]
Message-ID: <465BFF89.4030801@gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0705290526590.24445@localhost.localdomain>
Robert P. J. Day wrote:
> is there any rationale for setting a member of the file_operations
> structure explicitly to NULL as opposed to leaving it initialized? i
> would think that's the default just based on the rules for C
> initialization, but i just wanted to make sure since i see it done
> every so often and wonder if there's something tricky going on that i
> don't know about.
>
> rday
>
>
Actually, C doesn't really care ... if you declare something, but don't
initialize it explicitly,
it will be filled with some random value (probably whatever was at the
given memory address
before C gave it to your var). It makes sense to initialize something to
NULL because then
we can run value checks and we know what to expect if the value isn't
something we put in there.
Hope this helps.
-acripps
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
next prev parent reply other threads:[~2007-05-29 10:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-29 9:29 [KJ] setting fops member pointers to NULL? Robert P. J. Day
2007-05-29 10:13 ` Aaron Cripps [this message]
2007-05-29 14:00 ` John Anthony Kazos Jr.
2007-05-29 14:13 ` Arnaldo Carvalho de Melo
2007-05-29 14:30 ` Robert P. J. Day
2007-05-29 14:55 ` John Anthony Kazos Jr.
2007-05-29 15:04 ` Bernd Petrovitsch
2007-05-29 15:28 ` Arnaldo Carvalho de Melo
2007-05-29 15:57 ` Arnaldo Carvalho de Melo
2007-05-29 16:07 ` Robert P. J. Day
2007-05-29 16:16 ` Arnaldo Carvalho de Melo
2007-05-30 2:59 ` John Anthony Kazos Jr.
2007-05-30 14:41 ` Arnaldo Carvalho de Melo
2007-05-30 22:41 ` John Anthony Kazos Jr.
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=465BFF89.4030801@gmail.com \
--to=acripps@gmail.com \
--cc=kernel-janitors@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.