Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!bloom-beacon.mit.edu!bloom-beacon.mit.edu!panix!not-for-mail From: Grant Edwards Newsgroups: comp.lang.python Subject: Re: Question about math.pi is mutable Date: Sun, 8 Nov 2015 03:31:59 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 21 Message-ID: References: <87d1vlzy4p.fsf@elektro.pacujo.net> <878u69zxww.fsf@elektro.pacujo.net> <87y4e9y9j6.fsf@elektro.pacujo.net> NNTP-Posting-Host: c-24-118-110-103.hsd1.mn.comcast.net X-Trace: reader1.panix.com 1446953519 22950 24.118.110.103 (8 Nov 2015 03:31:59 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Sun, 8 Nov 2015 03:31:59 +0000 (UTC) User-Agent: slrn/1.0.2 (Linux) Xref: csiph.com comp.lang.python:98420 On 2015-11-07, Marko Rauhamaa wrote: > Grant Edwards : > >> I take it you don't write embedded code that runs from ROM? I do. The >> const keyword is the most valuable addition to the C language since >> the function prototype. Without it, you used to have to jump through >> all sorts of hoops to get read-only data placed into read-only memory. > > If all you need is a linker directive that places data in a read-only > section, "const" is a very ineffective tool that clutters the code and > forces you to sprinkle type casts around your code. But it allows the compiler to warn you if you pass a pointer to a read-only data to a function that expects a pointer to writable data. For those of us who occasionally make mistakes, such compiler warnings are very useful. -- Grant