ldc executable crashes with this code

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Feb 4 17:23:06 UTC 2022


On Fri, Feb 04, 2022 at 03:58:19PM +0000, Stanislav Blinov via Digitalmars-d-learn wrote:
[...]
> As others have already stated, casting immutability away is something
> that has to be supported, e.g. to interface with const-agnostic APIs.
> `@safe` requires such casts to be more verbose, with good reason.

Not to mention, casting to/from immutable is necessary in order to be
able to implement D's GC in D.

Basically, a cast is equivalent to telling the compiler "I know what I'm
doing, don't complain".  Generally casts should be avoided except under
special circumstances.


T

-- 
Fact is stranger than fiction.


More information about the Digitalmars-d-learn mailing list