"Semi-const" methods?

Magnus Lie Hetland magnus at hetland.org
Mon Mar 14 04:01:40 PDT 2011


On 2011-03-14 00:17:18 +0100, Jonathan M Davis said:

> So, if you don't actually manage to _really_
> be logically const, or if you do this with an immutable object (which would
> likely result in a segfault), you _are_ going to have incorrect code. On the
> whole, I'd advise just not using const when you need logical const, but if
> you're _very_ careful, you can get away with it. But thanks to 
> immutable, it can
> be _very_ dangerous to cast away constness in a const function unless you're
> _very_ careful.
> 
> You really should check out this question on stackoverflow and the answers that
> go with it: http://stackoverflow.com/questions/4219600/logical-const-in-d

Thanks for the insights + tip :)

-- 
Magnus Lie Hetland
http://hetland.org



More information about the Digitalmars-d-learn mailing list