I know very well how pointers are problematic. And maybe the design choices were too limited by C.
Since C++ have strong type matching, I was thinking what if pointers were initialized as either single or moveable(default). I don't know what keyword would be suitable.
Having a pointer be single would mean it's address couldn't be incremented or have an offset but it could be reassigned.
Now I don't think this would work on single objects though.
I've thought that a pointer to object to member like ptr->member; is handled as offset so the single pointer idea couldn't work.
Maybe if you a single double pointer to the object were really a pointer accessing the members.
The purpose would maybe help also distinguishing where to use delete or delete perhaps.
Could this be implemented while still keeping C compatible, though C++ has moved beyond always compatible.
This post has been edited by infernorthor: 10 April 2014 - 07:10 PM