public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Brown <david@westcontrol.com>
To: Miles Bader <miles@gnu.org>
Cc: gcc@gcc.gnu.org
Subject: Re: Volatile qualification on pointer and data
Date: Mon, 26 Sep 2011 08:53:00 -0000	[thread overview]
Message-ID: <4E802BB4.1030906@westcontrol.com> (raw)
In-Reply-To: <87k48wxhnq.fsf@catnip.gol.com>

On 26/09/2011 02:37, Miles Bader wrote:
> David Brown<david.brown@hesbynett.no>  writes:
>> So what advantages would there be in declaring a volatile buffer like
>> this to be "const"?  At best, you are helping the compiler check that
>> you don't accidentally write to it in your own code.
>
> That's actually pretty handy tho...
>

Oh, I'm all in favour of static error checking - use const pointers 
where possible, and there are not many of gcc's warning flags that I 
don't use.  But I'd weigh code clarity above error checking in this 
case, especially since it is very unlikely that you'd write code that 
accidentally wrote to the buffer.


WARNING: multiple messages have this Message-ID
From: David Brown <david@westcontrol.com>
To: gcc@gcc.gnu.org
Cc: gcc@gcc.gnu.org
Subject: Re: Volatile qualification on pointer and data
Date: Mon, 26 Sep 2011 08:58:00 -0000	[thread overview]
Message-ID: <4E802BB4.1030906@westcontrol.com> (raw)
Message-ID: <20110926085800.WZCTV3hhGA336KkfxocAv5zsKKDZHgBnoaRlL-_qtyM@z> (raw)
In-Reply-To: <87k48wxhnq.fsf@catnip.gol.com>

On 26/09/2011 02:37, Miles Bader wrote:
> David Brown<david.brown@hesbynett.no>  writes:
>> So what advantages would there be in declaring a volatile buffer like
>> this to be "const"?  At best, you are helping the compiler check that
>> you don't accidentally write to it in your own code.
>
> That's actually pretty handy tho...
>

Oh, I'm all in favour of static error checking - use const pointers 
where possible, and there are not many of gcc's warning flags that I 
don't use.  But I'd weigh code clarity above error checking in this 
case, especially since it is very unlikely that you'd write code that 
accidentally wrote to the buffer.



  reply	other threads:[~2011-09-26  7:41 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-20 16:08 Paulo J. Matos
2011-09-20 16:36 ` Ian Lance Taylor
2011-09-21  7:07   ` David Brown
2011-09-21  8:22     ` Paulo J. Matos
2011-09-21 10:20       ` David Brown
2011-09-21 13:57         ` Ian Lance Taylor
2011-09-21 14:25           ` David Brown
2011-09-21 14:57             ` Paulo J. Matos
2011-09-22  8:39               ` David Brown
2011-09-22 21:15               ` Richard Guenther
2011-09-23 11:33                 ` Paulo J. Matos
2011-09-23 11:51                   ` Paulo J. Matos
2011-09-23 13:17                 ` Paulo J. Matos
2011-09-21 18:51             ` Georg-Johann Lay
2011-09-22  8:53               ` David Brown
2011-09-24 15:10                 ` John Regehr
2011-09-24 15:49                   ` David Brown
2011-09-24 16:26                     ` David Brown
2011-09-24 19:38                     ` John Regehr
2011-09-25 13:03                       ` David Brown
2011-09-25 15:15                         ` Andreas Schwab
2011-09-25 16:33                           ` David Brown
2011-09-25 16:36                             ` David Brown
2011-09-25 16:06                         ` Dave Korn
2011-09-25 22:05                           ` David Brown
2011-09-25 22:05                             ` David Brown
2011-09-26  7:14                             ` Miles Bader
2011-09-26  8:53                               ` David Brown [this message]
2011-09-26  8:58                                 ` David Brown
2011-09-21  8:14   ` Paulo J. Matos

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=4E802BB4.1030906@westcontrol.com \
    --to=david@westcontrol.com \
    --cc=gcc@gcc.gnu.org \
    --cc=miles@gnu.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).