Did you know that inline assembly is safe?

Dany12L dany12719l at gmail.com
Sat May 6 16:38:56 UTC 2023


On Saturday, 6 May 2023 at 16:23:22 UTC, Quirin Schroll wrote:
>I guess,
> theoretically, assembly code can be `@safe` under very specific 
> circumstances, e.g. code that writes no memory. Useful? I don’t 
> think so.

Of course, for example this:

     void main() @safe {
         asm @safe {
             nop;
         }
     }

Technically it would be right to mark it as @safe, but it must be 
the compiler to evaluate whether it is safe or not.

Until we have a technology to do this (and honestly it would be 
useless in my opinion for the use of inline asm) we should not 
allow @safe in inline assembly



More information about the Digitalmars-d mailing list