Hacker News new | past | comments | ask | show | jobs | submit login

Strongly typed pointers is just another name for direct memory access.

The following is perfectly typesafe:

    SuperClass[] items = GetArrayOfSubClass();
Now if we try to do unsafe things to items, we may end up accidentally accessing memory we shouldn't.

    unsafe
    {
        for (int i=0; i < items.Length; i++)
        {
             var currentItem = &items[i*sizeof(SuperClass)];
        }
    }
This may or may not work, based on the runtime memory-layout of the subclass.

Basically the presence of unsafe {} means that beyond this point correctness cannot be guaranteed by the compiler. That's in fact what the keyword is for.

And that's the marker you are looking for. No need to go digging deeper into the code looking for the actual pointers themselves.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: