Simplification of @trusted

Elronnd elronnd at elronnd.net
Fri Jun 18 22:37:32 UTC 2021


On Thursday, 17 June 2021 at 10:28:42 UTC, Ola Fosheim Grøstad 
wrote:
> it could be helpful to list the invariants unsafe code depends 
> on, e.g.:
>
>
> ```
> @unsafe(assumes_singlethreaded){
>    …fast update of shared datastructure…
> }
>
> @unsafe(pointer_packing, pointer_arithmetics){

This also opens the door to more sophisticated compiler checking. 
  E.G. an @unsafe(pointer packing, pointer arithmetic) function 
can call an @unsafe(pointer arithmetic) function, but not an 
@unsafe(assumes singlethreaded) function.


More information about the Digitalmars-d mailing list