Click here to Skip to main content
15,890,512 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Exception handling in C++ Pin
Stuart Dootson19-Dec-08 2:24
professionalStuart Dootson19-Dec-08 2:24 
GeneralRe: Exception handling in C++ Pin
Jijo.Raj19-Dec-08 2:29
Jijo.Raj19-Dec-08 2:29 
GeneralRe: Exception handling in C++ Pin
Stuart Dootson19-Dec-08 2:34
professionalStuart Dootson19-Dec-08 2:34 
GeneralRe: Exception handling in C++ Pin
Jijo.Raj19-Dec-08 2:41
Jijo.Raj19-Dec-08 2:41 
GeneralRe: Exception handling in C++ Pin
Stuart Dootson19-Dec-08 2:54
professionalStuart Dootson19-Dec-08 2:54 
GeneralRe: Exception handling in C++ Pin
Jijo.Raj19-Dec-08 3:25
Jijo.Raj19-Dec-08 3:25 
GeneralRe: Exception handling in C++ Pin
Stuart Dootson19-Dec-08 3:42
professionalStuart Dootson19-Dec-08 3:42 
AnswerRe: Exception handling in C++ [modified] Pin
Stuart Dootson19-Dec-08 2:27
professionalStuart Dootson19-Dec-08 2:27 
Looks fine to me, aside from some formatting errors that cause compile-time errors.

Ignore the comments telling you to throw pointers to exception objects - throw the exception objects directly.

You may also want to derive from std::exception or std::runtime_error, to leverage the standard C++ exception classes?

Here's a minimal example of throwing exceptions with standard C++ exception classes:

#include <stdexcept>
#include <iostream>

int main(int, char**)
{
   try
   {
      throw std::runtime_error("Test");
   }
   catch(std::exception& e)
   {
      std::cerr << "Caught exception - " << e.what() << std::endl;
   };
}


modified on Friday, December 19, 2008 8:35 AM

AnswerRe: Exception handling in C++ Pin
Stuart Dootson19-Dec-08 2:58
professionalStuart Dootson19-Dec-08 2:58 
QuestionHow to prevent ScrollBar hiding in a ScrollView Pin
pauvc19-Dec-08 0:50
pauvc19-Dec-08 0:50 
QuestionFSCTL_GET_VOLUME_BITMAP Pin
john563218-Dec-08 23:59
john563218-Dec-08 23:59 
AnswerRe: FSCTL_GET_VOLUME_BITMAP Pin
Jijo.Raj19-Dec-08 0:24
Jijo.Raj19-Dec-08 0:24 
GeneralRe: FSCTL_GET_VOLUME_BITMAP Pin
john563219-Dec-08 0:41
john563219-Dec-08 0:41 
GeneralRe: FSCTL_GET_VOLUME_BITMAP Pin
Jijo.Raj19-Dec-08 0:46
Jijo.Raj19-Dec-08 0:46 
GeneralRe: FSCTL_GET_VOLUME_BITMAP Pin
john563219-Dec-08 1:12
john563219-Dec-08 1:12 
QuestionHow to extract a substring from a string in visual c++ Pin
kapardhi18-Dec-08 22:01
kapardhi18-Dec-08 22:01 
AnswerRe: How to extract a substring from a string in visual c++ Pin
Cedric Moonen18-Dec-08 22:15
Cedric Moonen18-Dec-08 22:15 
AnswerRe: How to extract a substring from a string in visual c++ Pin
Iain Clarke, Warrior Programmer18-Dec-08 22:19
Iain Clarke, Warrior Programmer18-Dec-08 22:19 
AnswerRe: How to extract a substring from a string in visual c++ Pin
Hamid_RT18-Dec-08 23:18
Hamid_RT18-Dec-08 23:18 
QuestionMultiple Row selection in the Grid. Pin
Royaltvk18-Dec-08 21:30
Royaltvk18-Dec-08 21:30 
Questiondifference between Events and functions Pin
shaina223118-Dec-08 21:03
shaina223118-Dec-08 21:03 
AnswerRe: difference between Events and functions Pin
Cedric Moonen18-Dec-08 21:12
Cedric Moonen18-Dec-08 21:12 
AnswerRe: difference between Events and functions Pin
Hamid_RT18-Dec-08 21:24
Hamid_RT18-Dec-08 21:24 
AnswerRe: difference between Events and functions Pin
Roger Stoltz18-Dec-08 22:05
Roger Stoltz18-Dec-08 22:05 
AnswerRe: difference between Events and functions Pin
Emilio Garavaglia18-Dec-08 23:09
Emilio Garavaglia18-Dec-08 23:09 

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.