public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "U.Mutlu" <for-gmane@mutluit.com>
To: linux-kernel@vger.kernel.org
Subject: Re: x86/MCE: drop bogus const modifier from AMD's bank4_names()
Date: Fri, 23 Jan 2015 16:04:46 +0100	[thread overview]
Message-ID: <m9tnue$fiu$1@ger.gmane.org> (raw)
In-Reply-To: <20150123101623.GB22635@pd.tnic>

Jan Beulich wrote, On 01/23/2015 09:32 AM:
>
> -static const char * const bank4_names(struct threshold_block *b)
> +static const char *bank4_names(const struct threshold_block *b)

There is a big difference in the return type, cf. below.
Of course, if possible, the more const the better.

Borislav Petkov wrote, On 01/23/2015 11:16 AM:
> On Fri, Jan 23, 2015 at 10:05:40AM +0000, Jan Beulich wrote:
>> It's been a long while ago that I noticed and fixed the warning, so
>> I don't recall the details. What I do know is that I didn't force any
>> extra flags, and that a similar issue elsewhere in the tree (fixed
>> in 3.19-rc5) triggered the same warning in at least one of my builds
>> (again without any extra warning options) in -rc4.
>
> Older compiler maybe. Not that it is worth wasting too much time on it
> though...

int main()
  {
    char mem1[] = "foo";
    char mem2[] = "bar";

    const char* const p1 = mem1;   // both ptr and content are const
    const char*       p2 = mem2;   // content is const, but not the ptr

// ++p1;         // not possible b/c p1 is const
    ++p2;         // possible b/c p2 is not const

// *p1 = 'X';    // not possible b/c content of p1 is const
// *p2 = 'A';    // not possible b/c content of p2 is const

    return 0;
  }


cu
Uenal


      reply	other threads:[~2015-01-23 15:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23  8:32 x86/MCE: drop bogus const modifier from AMD's bank4_names() Jan Beulich
2015-01-23  9:58 ` Borislav Petkov
2015-01-23 10:05   ` Jan Beulich
2015-01-23 10:16     ` Borislav Petkov
2015-01-23 15:04       ` U.Mutlu [this message]

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='m9tnue$fiu$1@ger.gmane.org' \
    --to=for-gmane@mutluit.com \
    --cc=linux-kernel@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