From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <3e1162e60512090825n4d944cc8yb2f668e3deb64dec@mail.gmail.com> Date: Fri, 9 Dec 2005 08:25:52 -0800 From: David Leimbach To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] const In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_5121_5388109.1134145552230" References: Topicbox-Message-UUID: bfdaee3e-ead0-11e9-9d60-3106f5b1d025 ------=_Part_5121_5388109.1134145552230 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 12/7/05, geoff@collyer.net wrote: > > I like Ken's comment in A New C Compiler: > > Volatile seems to have no meaning, so it is hard to tell if ignoring > it is a departure from the standard. Const only confuses library > interfaces with the hope of catching some rare errors. Volatile is useful for telling compilers not to stick data in registers, which is helpful for multi-threaded situations with shared memory ... sometimes :) If I were to write a semaphore or another synchronization method using shared memory on unix I'd probably type volatile and then pray :). It often feels more of a faith issue than a knowledge issue though :) Const is ok, sometimes, in some languages [C++]. It's notoriously difficul= t to add const interfaacs to C++ classes as an afterthought. You have to go in "full const" or none at all. Adding it afterwards causes a great deal o= f pain tracking down all the places you needed const when you didn't put it there. It's like playing pick up sticks with your buttcheeks. - [I think] the late John Candy. ------=_Part_5121_5388109.1134145552230 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline

On 12/7/05, geoff@collyer.net <= geoff@collyer.net> wrote:
I like Ken's comment in A New C Compiler:

Volatile seems to have no = meaning, so it is hard to tell if ignoring
it is a departure from the st= andard.  Const only confuses library
interfaces with the hope = of catching some rare errors.


Volatile is useful for telling compilers not to s= tick  data in registers, which is helpful for multi-threaded situation= s with shared memory ... sometimes :)

If I were to write a semaphore= or another synchronization method using shared memory on unix I'd probably= type volatile and then pray :).

It often feels more of a faith issue than a knowledge issue though = :)

Const is ok, sometimes, in some languages [C++].  It's notor= iously difficult to add const interfaacs to C++ classes as an afterthought.=   You have to go in "full const" or none at all.  Addin= g it afterwards causes a great deal of pain tracking down all the places yo= u needed const when you didn't put it there. =20

It's like playing pick up sticks with your buttcheeks. - [I think] = the late John Candy.




------=_Part_5121_5388109.1134145552230--