All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: dccp@vger.kernel.org
Subject: Re: [RFC]: field name identifier conventions
Date: Sat, 20 Oct 2007 21:03:49 +0000	[thread overview]
Message-ID: <20071020210349.GA4326@ghostprotocols.net> (raw)
In-Reply-To: <200710201654.35326@strip-the-willow>

Em Sat, Oct 20, 2007 at 04:54:35PM +0100, Gerrit Renker escreveu:
> I have a question/suggestion for DCCP/CCID field names, which have a tendency to grow
> into really_quite_long_strings. The convention for field members seems to be
> 
> 
> 	"x"->"x"_<fieldname>
> 
> Examples are in particular
> 
>    * hctx->ccid2hctx_<fieldname>
>    * hcrx->ccid3hcrx_<fieldname>
>    * avr->dccpavr_<fieldname>
>    * av->dccpav_<fieldname>
> 
> The problem is that this naming convention has no apparent benefits: 
>   
>   * which struct is used is evident from the context and need not be encoded
>   * someone reading the code is only interested in the fieldnames
>   * with the line length limit of 80 characters this convention almost inevitably leads to
>     multi-line expression for even the simplest kinds of comparisons and expressions.
> 
> Hence my suggestion is to reduce the replicated "x" field prefix, so that field members become
> shorter, as will be expressions, and the code would be easier to read.
> 
> What is the opinion of other developers / maintainer regarding this? 

Well, while I agree that the names being overly long its a nuisance at
the same time being able to grep for some specific field is really nice
and was the intention.

Long ago DaveM accepted patches for struct sock, but then there its just
->sk_FIELD_NAME, not 10 characters like in the ccids case. struct inode
fields predate that even, but then its just ->i_FIELD_NAME.

I think that providing a unique namespace for struct member names is ok
if it doesn't get that long (mea culpa in the aforementioned cases 8)).

- Arnaldo

  reply	other threads:[~2007-10-20 21:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-20 15:54 [RFC]: field name identifier conventions Gerrit Renker
2007-10-20 21:03 ` Arnaldo Carvalho de Melo [this message]
2007-10-20 21:08 ` Arnaldo Carvalho de Melo
2007-10-21  1:56 ` Ian McDonald
2007-10-21  2:54 ` Łeandro Sales
2007-10-22 11:20 ` Tommi Saviranta
2007-10-22 14:50 ` Gerrit Renker

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=20071020210349.GA4326@ghostprotocols.net \
    --to=acme@ghostprotocols.net \
    --cc=dccp@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.