Hmm - about manifest/enum

Derek Parnell derek at psych.ward
Fri Dec 28 22:47:50 PST 2007


On Sat, 29 Dec 2007 00:35:41 -0500, Jarrett Billingsley wrote:

> "Mike" <vertex at gmx.at> wrote in message news:op.t32vfhhpkgfkbn at lucia...
 
>> What problem does constness solve anyway?

> Const isn't going to go away for the simple fact that there will always be 
> people who were raised on C++ who think that you *need* const to do 
> *anything* and *anything else* is heresy.

I thought the purpose of identifying immutable values to the compiler was
to enable the compiler to perform optimiziation if it can, and to help the
compiler to determine the correctness of algorithms.

Optimisations would include being able to place such data in true ROM, use
immediate values in the machine code where possible, allow caching of
values across function calls, etc ...

Correctness in terms of ensure that if the coder says something must not be
modified, the compiler can detect code that attempts to do that.

So I guess its not a necessary requirement but it is a nice thing to have,
so we can lower the cost of developing acceptable applications.

-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell



More information about the Digitalmars-d mailing list