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

Walter Bright newshound2 at digitalmars.com
Wed Jan 24 01:44:51 UTC 2018


On 1/23/2018 4:42 PM, Mike Franklin wrote:
> 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.

It's an extremely useful argument, though, as modern computers have virtual 
memory systems that map 0 to a seg fault, and have since the 80's, specifically 
because it DOES catch lots and lots of bugs.

I always thought the IBM PC should have put the ROMs at address 0 instead of 
FFFF0. It probably would have saved billions of dollars.


> I have a micocontroller in front of me where an address of null (essentially 0) is a 
> perfectly valid memory address.

Microcontroller code tends to be small and so it's unlikely that you'll need to 
worry about it.



More information about the Digitalmars-d mailing list