public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Grant Erickson <gerickson@nuovations.com>
To: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Cc: linux-mtd@lists.infradead.org
Subject: Re: [PATCH 1/6] [MTD-UTILS] nandwrite: Qualifier Clean-up
Date: Tue, 09 Sep 2008 09:30:17 -0700	[thread overview]
Message-ID: <C4EBF2A9.11917%gerickson@nuovations.com> (raw)
In-Reply-To: <lybpyxa1x8.fsf@ensc-virt.intern.sigma-chemnitz.de>

On 9/9/08 6:23 AM, Enrico Scholz wrote:
> Grant Erickson <gerickson@nuovations.com> writes:
>> +static const char *mtd_device, *img;
> 
> would it be possible to split this into two declarations?  I
> really don't know if 'img' points to a constant or non-constant
> char...

As currently implemented, both mtd_device and img point to effectively
read-only information. That is, there is no need to modify or to attempt to
modify what they point to.

Should that change in the future, these can be declared differently;
however, for the present, the const qualifier accurately represents program
intent.

>> -int main(int argc, char **argv)
>> +int main(int argc, char * const argv[])
> 
> Is this really correct?  C standard mentions only
> 
>                int main(void) { /* ... */ }
>                int main(int argc, char *argv[]) { /* ... */ }
> 
> as program entry points.  I suggest to cast 'argv' to a corresponding
> data type when it is used.

Those are certainly the two most common prototypes for main. However,
because main has no prototype, adding the const qualifier simply conveys
current program intent. That is, the strings pointed to by argv are not
modified.

Regards,

Grant

  reply	other threads:[~2008-09-09 16:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-08  4:24 [PATCH 1/6] [MTD-UTILS] nandwrite: Qualifier Clean-up Grant Erickson
2008-09-08  5:28 ` Artem Bityutskiy
2008-09-08 14:17   ` Josh Boyer
2008-09-09  4:51     ` Artem Bityutskiy
2008-09-09 13:23 ` Enrico Scholz
2008-09-09 16:30   ` Grant Erickson [this message]
2008-09-09 17:14     ` Enrico Scholz
2008-09-14 19:43       ` Grant Erickson

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=C4EBF2A9.11917%gerickson@nuovations.com \
    --to=gerickson@nuovations.com \
    --cc=enrico.scholz@sigma-chemnitz.de \
    --cc=linux-mtd@lists.infradead.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