Yet another const system - for everyone to enjoy
James Dennett
jdennett at acm.org
Thu Sep 13 20:48:49 PDT 2007
Alex Burton wrote:
> I wrote myself a piece of c++ code that proves how useless c++ const is.
I'll call it there.
No piece of code you write can do any such thing; it can only
show that const is useless in that piece of code, or at best
show that const has some limitations.
A compiler can't enforce logical constness perfectly without
incorporating a full-blown language for correctness proofs,
unless it has very unpleasant restrictions in its language.
That doesn't make const or similar "useless". It just means
you can't expect a silver bullet for ensuring correctness of
code; it's still necessary to use human intelligence and good
design as well as tools.
-- James
More information about the Digitalmars-d
mailing list