Shouldn't invalid references like this fail at compile time?

Mike Franklin slavo5150 at yahoo.com
Wed Jan 24 00:42:01 UTC 2018


On Tuesday, 23 January 2018 at 21:53:24 UTC, Steven Schveighoffer 
wrote:

> [1] Note: the reason they are safe is because they generally 
> result in a segfault, which doesn't harm any memory. This is 
> very much a user-space POV, and doesn't take into account 
> kernel-space where null dereferences may actually be valid 
> memory! It also doesn't (currently) take into account possible 
> huge objects that could extend into valid memory space, even in 
> user space.

That's what kindof ticks me off about this "null is memory safe" 
argument; it seems to be only applicable to a specific platform 
and environment.  I have a micocontroller in front of me where an 
address of null (essentially 0) is a perfectly valid memory 
address.

Mike


More information about the Digitalmars-d mailing list