dChar Error

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Fri Dec 30 05:46:32 UTC 2022


On 30/12/2022 6:37 PM, Salih Dincer wrote:
> On Friday, 30 December 2022 at 04:54:39 UTC, Richard (Rikki) Andrew 
> Cattermole wrote:
>>
>> So when you duplicated it, it was no longer in ROM, and therefore 
>> writable.
> 
> There is no such thing as a ROM within a function.

But a function can reference things in ROM, and a function itself can 
and should be held within ROM.

> Because str is a 
> reference and slc is a local copy, right?

It is a reference to memory that is in ROM. No, it is not a copy of the 
memory, only of the reference.

You shouldn't be casting away immutable btw, (which is what string is!).

> Have you tried running the 
> code?  Okay, no string literals:

Of course; I cannot see anything else that could cause this in the 
assembly either.


More information about the Digitalmars-d-learn mailing list