Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!mit.eternal-september.org!.POSTED!not-for-mail From: Richard Newsgroups: comp.lang.c Subject: Re: Is enum a suitable way to implement a "local define?" Date: Thu, 10 Apr 2014 09:08:29 +0100 Organization: http://www.ieee.org/ Lines: 56 Message-ID: <878urdy5c2.fsf@gmail.com> References: <75dbfab4-304e-49c3-b655-16c085f60e4c@googlegroups.com> <6Rw0v.226822$4l4.136348@fx23.am4> <4Sz0v.75086$Yw3.15453@fx15.am4> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mit.eternal-september.org; posting-host="5d2c20eb57d1f93a389162df95882eaf"; logging-data="9472"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19wKR5Gi1QA6dhBHalVTFWRHg0xSnuWA0A=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:0ZM50t4XoyCJUbCKewCsZcQ3P/o= sha1:ioxWIFDTVT5v2AHA/CDG4fnGx3s= Xref: csiph.com comp.lang.c:42749 Keith Thompson writes: > David Brown writes: >> On 09/04/14 08:05, Keith Thompson wrote: >>> David Brown writes: >>>> On 09/04/14 00:27, BartC wrote: >>> [...] >>>>> Instead of a simple, logical extension to allow such a declaration, >>>>> where it will be completely obvious what it is and what it can do, >>>>> you instead propose using a *variable* for the purpose, which so many >>>>> issues associated with it that I hardly know where to start! But I >>>>> will have a go: >>>> >>>> A "const" is not a variable - it is a constant object. So instead of >>>> introducing some sort of new type of constant to the language, I would >>>> rather take the existing const concept and extend it slightly (as it is >>>> in C++) to cover the remaining needs for constants. That is far >>>> simpler, clearer and easier than having a new type of constant - and it >>>> already exists in C++. >>> >>> You're conflating "const" and "constant" in a context where the >>> distinction is extremely relevant. >> >> Perhaps - I certainly agree that we must be as clear as possible here. > > [...] > >>> It's not entirely clear what the word "variable" should mean in C. The >>> standard doesn't use the term; instead it uses "object". Is a >>> const-qualified object a "variable"? You could probably get three >>> different answers from three different people here; mine is that I avoid >>> using the word "variable" when there's any chance of confusion. >> >> I view "variable" to mean something that can legally be changed after >> its creation and initialisation. > > That's not an unreasonable definition -- but it's still not entirely > unambiguous. Someone might refer to a const-qualified object as a > "variable". And a member of a non-const struct object is an object that > can be modified, but is it a variable or just part of one? What about > an array element? What about an object allocated by malloc()? > > The words "const", "constant", and "object", have well-defined meanings > in C. "Variable" doesn't. I suggest just avoiding that word, at least > in this discussion. Without the application of "const" in any shape or form it has a very well defined meaning. The clue is in what "variable" means and in addition to that real humans are capable of understanding what someone means when they say "a constant int" for example. -- "Avoid hyperbole at all costs, its the most destructive argument on the planet" - Mark McIntyre in comp.lang.c