mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Willy Tarreau <willy@w.ods.org>
To: Arjan van de Ven <arjan@infradead.org>
Cc: Jeff Garzik <jgarzik@pobox.com>, Adrian Bunk <bunk@stusta.de>,
	linux-net@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [2.6 patch] drivers/net/smc-mca.c: cleanups
Date: Sat, 19 Feb 2005 16:23:00 +0100	[thread overview]
Message-ID: <20050219152300.GF1850@alpha.home.local> (raw)
In-Reply-To: <1108804140.6304.67.camel@laptopd505.fenrus.org>

On Sat, Feb 19, 2005 at 10:09:00AM +0100, Arjan van de Ven wrote:
> On Sat, 2005-02-19 at 03:41 -0500, Jeff Garzik wrote:
> > Adrian Bunk wrote:
> > > This patch contains the following cleanups:
> > > - make a needlessly global function static
> > > - make three needlessly global structs static
> > > 
> > > Since after moving the now-static stucts to smc-mca.c the file smc-mca.h 
> > > was empty except for two #define's, I've also killed the rest of 
> > > smc-mca.h .
> > 
> > It looks like the structs should be 'static const', not just 'static'.
> > 
> > This comment is applicable to similar changes, also.  Use 'const' 
> > whenever possible.
> 
> does that even have meaning in C? In C++ it does, but afaik in C it
> doesn't.

Yes it does. Often the variables declared this way will go into the text
section which is marked read-only. I've used this technique in a few very
small programs to reduce their size (I could strip off both their bss and
data sections to save space). Also, I believe that the compiler is able
to optimize code using consts, but this is pure speculation, I've not
verified it.

Willy


  parent reply	other threads:[~2005-02-19 15:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-19  8:34 Adrian Bunk
2005-02-19  8:41 ` Jeff Garzik
2005-02-19  9:09   ` Arjan van de Ven
2005-02-19  9:18     ` Jeff Garzik
2005-02-19 15:23     ` Willy Tarreau [this message]
2005-02-19 15:43       ` Arjan van de Ven
2005-02-20 10:37         ` Herbert Xu
2005-02-21  1:26 ` Jeff Garzik
2005-02-21 14:48   ` Adrian Bunk
2005-03-12 22:27 Adrian Bunk
2005-03-27 14:34 Adrian Bunk

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=20050219152300.GF1850@alpha.home.local \
    --to=willy@w.ods.org \
    --cc=arjan@infradead.org \
    --cc=bunk@stusta.de \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-net@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®