Click here to Skip to main content
16,010,394 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Parsing in C Pin
Ryan Binns26-May-03 2:22
Ryan Binns26-May-03 2:22 
GeneralRe: Parsing in C Pin
Rickard Andersson2026-May-03 5:27
Rickard Andersson2026-May-03 5:27 
GeneralSimple get started questions Pin
Jon H25-May-03 22:44
Jon H25-May-03 22:44 
GeneralRe: Simple get started questions Pin
Andrew Walker25-May-03 23:32
Andrew Walker25-May-03 23:32 
Generalunicode, resources Pin
Joerg Wiedenmann25-May-03 22:24
Joerg Wiedenmann25-May-03 22:24 
GeneralRe: unicode, resources Pin
John R. Shaw26-May-03 10:29
John R. Shaw26-May-03 10:29 
GeneralConstruct Null Object If I/O Operation Fail In The Constructor Pin
yccheok25-May-03 22:22
yccheok25-May-03 22:22 
GeneralRe: Construct Null Object If I/O Operation Fail In The Constructor Pin
Andrew Walker25-May-03 22:38
Andrew Walker25-May-03 22:38 
yccheok wrote:
i wish to have an null object if there is io operation fail in the constructor.

Constructors will never return NULL.

If you want to represent an error in a constructor you have a number of choices.

1/ Set an internal flag in your class to show that the IO Operation failed, and check that flag before you continue. The standard iostream library does this.
2/ Throw an exception

try
{
  CXXXManager *cm = new CXXXManager();
}
catch(IOEx& ex)
{
  // handler here
}

Solution 2 is the preferred solution, at least in my mind, because errors always have to be dealt with.

Note: that this is different to a failure with the allocation of memory, in which some non-standard compilers (eg/ MSVC6) will return NULL. The accepted behavior for memory allocation failure is now to throw std::bad_alloc
GeneralRe: Construct Null Object If I/O Operation Fail In The Constructor Pin
Ryan Binns26-May-03 1:59
Ryan Binns26-May-03 1:59 
GeneralDebugging OLE Automation Application Pin
vcseeker25-May-03 22:22
vcseeker25-May-03 22:22 
GeneralFormat of the Visual C++ Intellisense File Pin
Franz Klein25-May-03 21:58
Franz Klein25-May-03 21:58 
GeneralWhy my activex ctrl(MFC,not ATL) can only run at IE6 Pin
fengjn25-May-03 21:26
fengjn25-May-03 21:26 
QuestionHow to get the index of the current hot item of the CListCtrl? Pin
iamhcj25-May-03 20:54
iamhcj25-May-03 20:54 
AnswerRe: How to get the index of the current hot item of the CListCtrl? Pin
Michael Dunn25-May-03 22:30
sitebuilderMichael Dunn25-May-03 22:30 
GeneralReally strange problem , solution !!! :-) Pin
Cedric Moonen25-May-03 20:53
Cedric Moonen25-May-03 20:53 
GeneralRe: Really strange problem , solution !!! :-) Pin
Rage25-May-03 22:39
professionalRage25-May-03 22:39 
GeneralRe: Really strange problem , solution !!! :-) Pin
Neville Franks25-May-03 22:46
Neville Franks25-May-03 22:46 
GeneralGet File Type Extenstons.......... Pin
rohit.dhamija25-May-03 20:44
rohit.dhamija25-May-03 20:44 
GeneralRe: Get File Type Extenstons.......... Pin
Rage25-May-03 22:57
professionalRage25-May-03 22:57 
GeneralRe: Get File Type Extenstons.......... Pin
rohit.dhamija25-May-03 23:33
rohit.dhamija25-May-03 23:33 
QuestionWill the professional programmers please help me here with my DieClass? Pin
Link260025-May-03 19:15
Link260025-May-03 19:15 
AnswerRe: Will the professional programmers please help me here with my DieClass? Pin
Michael Dunn25-May-03 19:33
sitebuilderMichael Dunn25-May-03 19:33 
AnswerRe: Will the professional programmers please help me here with my DieClass? Pin
Xander8025-May-03 19:35
Xander8025-May-03 19:35 
GeneralRe: Will the professional programmers please help me here with my DieClass? Pin
Link260025-May-03 20:30
Link260025-May-03 20:30 
GeneralRe: Will the professional programmers please help me here with my DieClass? Pin
Rage25-May-03 22:51
professionalRage25-May-03 22:51 

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.