Click here to Skip to main content
15,398,211 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: any way to detect, catch or provent crash from an invalid pointer? Pin
David Crow9-May-11 7:38
MemberDavid Crow9-May-11 7:38 
GeneralRe: any way to detect, catch or provent crash from an invalid pointer? Pin
includeh109-May-11 9:45
Memberincludeh109-May-11 9:45 
GeneralRe: any way to detect, catch or provent crash from an invalid pointer? Pin
Chris Losinger9-May-11 12:13
professionalChris Losinger9-May-11 12:13 
AnswerRe: any way to detect, catch or provent crash from an invalid pointer? Pin
Richard MacCutchan9-May-11 7:53
mveRichard MacCutchan9-May-11 7:53 
AnswerRe: any way to detect, catch or provent crash from an invalid pointer? Pin
Luc Pattyn9-May-11 8:06
sitebuilderLuc Pattyn9-May-11 8:06 
GeneralRe: any way to detect, catch or provent crash from an invalid pointer? Pin
Richard MacCutchan9-May-11 9:23
mveRichard MacCutchan9-May-11 9:23 
GeneralRe: any way to detect, catch or provent crash from an invalid pointer? Pin
Luc Pattyn9-May-11 9:41
sitebuilderLuc Pattyn9-May-11 9:41 
GeneralRe: any way to detect, catch or provent crash from an invalid pointer? Pin
CPallini9-May-11 10:34
mveCPallini9-May-11 10:34 
You're are wrong (even if you're always right!), jschell answer below is correct.
The code
p->GetName();

simply works because there's no usage of the implicit passed this pointer inside.
Try, for instance:
C++
#include <iostream>
using namespace std;
class A
{
  int a;
public:
  void play(){cout << "Hi Luc!" << endl;}
  void game_over(){cout << a << endl;}
};

int main()
{
  A * pa = 0;
  pa->play();
  pa->game_over();
  return 0;
}

If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke

[My articles]

GeneralRe: any way to detect, catch or provent crash from an invalid pointer? Pin
Luc Pattyn9-May-11 11:17
sitebuilderLuc Pattyn9-May-11 11:17 
AnswerRe: any way to detect, catch or provent crash from an invalid pointer? Pin
jschell9-May-11 9:29
Memberjschell9-May-11 9:29 
AnswerRe: any way to detect, catch or provent crash from an invalid pointer? Pin
varunpandeyengg9-May-11 22:47
Membervarunpandeyengg9-May-11 22:47 
QuestionHow correctly set User Properties to MS Outlook Mail Item in MFC Pin
Member 29729929-May-11 5:19
MemberMember 29729929-May-11 5:19 
AnswerRe: How correctly set User Properties to MS Outlook Mail Item in MFC Pin
David Crow9-May-11 6:00
MemberDavid Crow9-May-11 6:00 
GeneralRe: How correctly set User Properties to MS Outlook Mail Item in MFC Pin
Member 29729929-May-11 6:16
MemberMember 29729929-May-11 6:16 
GeneralRe: How correctly set User Properties to MS Outlook Mail Item in MFC Pin
David Crow9-May-11 6:26
MemberDavid Crow9-May-11 6:26 
AnswerRe: How correctly set User Properties to MS Outlook Mail Item in MFC Pin
Roger Broomfield9-May-11 7:11
MemberRoger Broomfield9-May-11 7:11 
GeneralRe: How correctly set User Properties to MS Outlook Mail Item in MFC Pin
Member 297299210-May-11 12:09
MemberMember 297299210-May-11 12:09 
GeneralRe: How correctly set User Properties to MS Outlook Mail Item in MFC Pin
Roger Broomfield10-May-11 15:47
MemberRoger Broomfield10-May-11 15:47 
Questionwhich book should read? Pin
baojianbing9-May-11 4:42
Memberbaojianbing9-May-11 4:42 
AnswerRe: which book should read? Pin
Maximilien9-May-11 4:53
MemberMaximilien9-May-11 4:53 
GeneralRe: which book should read? Pin
baojianbing9-May-11 14:32
Memberbaojianbing9-May-11 14:32 
AnswerRe: which book should read? Pin
Dalek Dave19-May-11 13:17
professionalDalek Dave19-May-11 13:17 
QuestionGet amount of free memory Pin
jung-kreidler9-May-11 4:24
Memberjung-kreidler9-May-11 4:24 
AnswerRe: Get amount of free memory Pin
David Crow9-May-11 5:53
MemberDavid Crow9-May-11 5:53 
GeneralRe: Get amount of free memory Pin
jung-kreidler9-May-11 22:30
Memberjung-kreidler9-May-11 22:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.