dereferencing null
Jacob Carlborg
doob at me.com
Fri Mar 2 04:50:41 PST 2012
On 2012-03-02 12:05, Jonathan M Davis wrote:
> On Friday, March 02, 2012 11:56:52 Jacob Carlborg wrote:
>> I never thought about that.
>
> It's the same in C++. I was quite surprised when I first ran into it. But as
> Daniel points out, the behavior is still defined, just less expected. If you
> actually use this (or any member variable, since that would use this) inside
> of that member function though, you'll get a segfault just like if it had been
> dereferenced before calling the function like it would be with a virtual
> function.
>
> - Jonathan M Davis
Yeah, that makes sense. A final method, not accessing "this", would be
just as a static method. Which is like a free function scoped in a class.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list