Linux NFS development
 help / color / mirror / Atom feed
From: Frank van Maarseveen <frankvm@frankvm.com>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: nfs@lists.sourceforge.net, Frank van Maarseveen <frankvm@frankvm.com>
Subject: Re: [PATCH 02/10] NFS: Use C99 struct initializers in nfs4proc.c
Date: Thu, 31 May 2007 14:19:47 +0200	[thread overview]
Message-ID: <20070531121947.GA26565@janus> (raw)
In-Reply-To: <1180613931.6696.36.camel@heimdal.trondhjem.org>

On Thu, May 31, 2007 at 08:18:51AM -0400, Trond Myklebust wrote:
> On Thu, 2007-05-31 at 10:18 +0200, Frank van Maarseveen wrote:
> > On Wed, May 30, 2007 at 04:12:27PM -0400, Trond Myklebust wrote:
> > > On Tue, 2007-05-29 at 10:10 -0400, Chuck Lever wrote:
> > > > Trond Myklebust wrote:
> > > > > On Fri, 2007-05-25 at 17:41 -0400, Chuck Lever wrote:
> > > > >> Follow kernel coding conventions.
> > > > >>
> > > > >> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> > > > >> ---
> > > > >>
> > > > >>  fs/nfs/nfs4_fs.h  |    5 ++++
> > > > >>  fs/nfs/nfs4proc.c |   70 ++++++++++++++++++++++++++++-------------------------
> > > > >>  2 files changed, 42 insertions(+), 33 deletions(-)
> > > > >>
> > > > >> diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
> > > > >> index cf3a17e..1a526c4 100644
> > > > >> --- a/fs/nfs/nfs4_fs.h
> > > > >> +++ b/fs/nfs/nfs4_fs.h
> > > > >> @@ -145,6 +145,11 @@ struct nfs4_exception {
> > > > >>  	int retry;
> > > > >>  };
> > > > >>  
> > > > >> +#define DECLARE_NFS4_EXCEPTION(name)				\
> > > > >> +	struct nfs4_exception name = {				\
> > > > >> +		.timeout	= 0,				\
> > > > >> +	}
> > > > > 
> > > > > Why would we want this? The existing code uses bog standard C99
> > > > > initialisers. There is no need to explicitly set .timeout to zero.
> > > > 
> > > > Using
> > > > 
> > > >    struct nfs4_exception name = { };
> > > > 
> > > > causes compiler complaints.  One correct way to fix this is to set at 
> > > > least one field in the structure, and setting that field to zero clears 
> > > > the other one by default.
> > > 
> > > I can't find anything in Harbison & Steele stating that name = {} is
> > > illegal. All they say is that "if there are fewer initializers than
> > > there are structure components, the remaining components are initialized
> > > to their default initial values.".
> > 
> > AFAIK and I checked ISO/IEC 9899:1999 to be sure, {initializer-list}
> > cannot be empty according to the C syntax.
> 
> but a trivial initialiser like "name = {0}" is, right?

yes.

-- 
Frank

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

  reply	other threads:[~2007-05-31 12:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-25 21:41 [PATCH 02/10] NFS: Use C99 struct initializers in nfs4proc.c Chuck Lever
2007-05-26 18:01 ` Trond Myklebust
2007-05-29 14:10   ` Chuck Lever
2007-05-30 20:12     ` Trond Myklebust
2007-05-31  8:18       ` Frank van Maarseveen
2007-05-31 12:18         ` Trond Myklebust
2007-05-31 12:19           ` Frank van Maarseveen [this message]
2007-05-31 15:14       ` Chuck Lever
2007-05-31 16:18         ` Trond Myklebust
2007-05-31 17:11           ` Chuck Lever

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=20070531121947.GA26565@janus \
    --to=frankvm@frankvm.com \
    --cc=nfs@lists.sourceforge.net \
    --cc=trond.myklebust@fys.uio.no \
    /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