From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom To: 9fans@cse.psu.edu, Russ Cox References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 In-Reply-To: Subject: Re: [9fans] const Message-Id: <20051207130107.224496A9@dexter-peak.quanstro.net> Date: Wed, 7 Dec 2005 07:01:07 -0600 Cc: Topicbox-Message-UUID: bbfa7c9e-ead0-11e9-9d60-3106f5b1d025 i've found const pretty useful, dispite the fact it does create some inconsistencies. it's chief virtue is that you can tell without looking any further than the prototype that a function that takes a const char* makes it's own copy, if it needs one. if you're careful with const, i think it can be a help in preventing some silly mistakes that will cause a benign looking program to get up and fandango on core. unfortunately, glibc, for example, is not very consistant. dispite the fact that it returns a pointer into envp, glibc getenv is declared as "char* getenv(const char*);". - erik Russ Cox writes | | > I'm trying to find a reference to a tirade against | > the C const type qualifier. I think it was writtent | > during the ANSI-isation of C by dmr or perhaps bwk, | > (or was it was rob). | | http://www.lysator.liu.se/c/dmr-on-noalias.html | http://tinyurl.com/8435y | | The second (actually a Google Groups url) explains the first. | | Russ