Error: mutable method isolated.graphics.g3d.model.Model.begin is not callable using a const object

ag0aep6g via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jun 6 14:55:00 PDT 2016


On 06/06/2016 11:25 PM, Alex Parrill wrote:
> You might be able to get away with casting the const away, if you are
> sure it won't modify the hash or equality check.

Casting away const and then mutating has undefined behavior. The 
compiler is free to assume that it doesn't happen.

Be aware that you're working outside of the specified language if you do 
it. You rely on the compiler producing code that works in your favor 
when it has no obligation to do so.

I don't think we should ever suggest relying on undefined behavior here 
in D.learn.


More information about the Digitalmars-d-learn mailing list