From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11409 invoked by alias); 26 Sep 2011 07:41:32 -0000 Received: (qmail 11300 invoked by uid 22791); 26 Sep 2011 07:41:30 -0000 X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL,BAYES_00,RCVD_NUMERIC_HELO,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from lo.gmane.org (HELO lo.gmane.org) (80.91.229.12) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 26 Sep 2011 07:41:15 +0000 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1R85oN-0006YO-F6 for gcc@gcc.gnu.org; Mon, 26 Sep 2011 09:41:11 +0200 Received: from 79.161.10.130 ([79.161.10.130]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 26 Sep 2011 09:41:11 +0200 Received: from david by 79.161.10.130 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 26 Sep 2011 09:41:11 +0200 To: gcc@gcc.gnu.org From: David Brown Subject: Re: Volatile qualification on pointer and data Date: Mon, 26 Sep 2011 08:58:00 -0000 Message-ID: <4E802BB4.1030906@westcontrol.com> References: <4E7A3209.10508@gjlay.de> <4E7DFB31.9010906@westcontrol.com> <4E7F4575.1030308@gmail.com> <4E7F57E2.7000204@hesbynett.no> <87k48wxhnq.fsf@catnip.gol.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: gcc@gcc.gnu.org User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:6.0.1) Gecko/20110830 Thunderbird/6.0.1 In-Reply-To: <87k48wxhnq.fsf@catnip.gol.com> X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2011-09/txt/msg00306.txt.bz2 Message-ID: <20110926085800.WZCTV3hhGA336KkfxocAv5zsKKDZHgBnoaRlL-_qtyM@z> On 26/09/2011 02:37, Miles Bader wrote: > David Brown 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.