C `restrict` keyword in D

dukc via Digitalmars-d digitalmars-d at puremagic.com
Tue Sep 5 12:42:11 PDT 2017


On Tuesday, 5 September 2017 at 18:32:34 UTC, Johan Engelen wrote:
> My point was that that is not workable. The "null dereference" 
> is a D language construct, not something that the machine is 
> doing. It's ridiculous to specify that reading from address 
> 1_000_000 should crash the program, yet that is exactly what is 
> specified by D when running this code (and thus null checks 
> need to be injected in many places to be spec compliant):
>
> ```
> struct S {
>   ubyte[1_000_000] a;
>   int b;
> }
> void main() {
>    S* s = null;
>    s.b = 1;
> }
> ```
>
> -Johan

Perhaps it should nullcheck exceptionally large types which may 
overflow the memory protected area, but not others?




More information about the Digitalmars-d mailing list