Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c++.moderated    |    Moderated discussion of C++ superhackery    |    33,346 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 32,486 of 33,346    |
|    Ulrich Eckhardt to All    |
|    Re: calling a member function of destroy    |
|    19 Jul 12 03:38:00    |
      From: ulrich.eckhardt@dominolaser.com              Am 19.07.2012 06:24, schrieb Venkat:       > Member function is not virtual, nor it's access object' state. It's       > working when I ran on. But I'm wondering if there is a technical       > reason this may blow in some context?              You could also use a null pointer to call that function, in most cases       it works. It is formally undefined behaviour though.              Also, a compiler that does an inspection of the call tree could figure       out that this calls a function on a destroyed object and react to that.       The only thing that currently saves you is that compilers aren't smart       enough yet.              You shouldn't wonder "when will this break?" but rather "is this       guaranteed to work?", except if you're just curious and not actually       planning to (ab)use this behaviour.              Greetings!              Uli                     --        [ See http://www.gotw.ca/resources/clcm.htm for info about ]        [ comp.lang.c++.moderated. First time posters: Do this! ]              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca