Click here to Skip to main content
15,897,273 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: exceptions [modified] Pin
toxcct29-May-06 0:10
toxcct29-May-06 0:10 
AnswerRe: exceptions Pin
ThatsAlok28-May-06 22:50
ThatsAlok28-May-06 22:50 
GeneralRe: exceptions Pin
toxcct29-May-06 0:14
toxcct29-May-06 0:14 
GeneralRe: exceptions Pin
ThatsAlok29-May-06 0:57
ThatsAlok29-May-06 0:57 
AnswerRe: exceptions [modified] Pin
Stephen Hewitt28-May-06 22:58
Stephen Hewitt28-May-06 22:58 
GeneralRe: exceptions [modified] Pin
toxcct29-May-06 0:18
toxcct29-May-06 0:18 
AnswerRe: exceptions [modified] Pin
toxcct29-May-06 0:08
toxcct29-May-06 0:08 
Questionassert VS exceptions [modified] Pin
big_denny_20028-May-06 22:01
big_denny_20028-May-06 22:01 
hi all Smile | :)

I saw this code :

inline int foo (char* pBuffer, const char* formatString) throw() {

   assert (pBuffer);
   assert (formatString);

   return "something";
}


If i use this code and in Release build and pass pBuffer, whose value will be NULL, than I get a bug yes ? these asserts are useful only in debug mode, not ?

Is not it better to above this function like this :
inline int foo (char* buffer, const char* formatString)  {

   if(NULL == buffer)
            throw  someException();

   if(NULL == formatString);
            throw someOtherException();

   return "something";
}


In this case if we catch the thrown exception than, we are secure in both Release ana Debug builds, not ?

so why use asserts and not throws?

thank you

-- modified at 4:01 Monday 29th May, 2006
AnswerRe: assert VS exceptions [modified] Pin
_AnsHUMAN_ 28-May-06 22:14
_AnsHUMAN_ 28-May-06 22:14 
GeneralRe: assert VS exceptions [modified] Pin
big_denny_20028-May-06 22:21
big_denny_20028-May-06 22:21 
GeneralRe: assert VS exceptions [modified] Pin
_AnsHUMAN_ 28-May-06 22:32
_AnsHUMAN_ 28-May-06 22:32 
AnswerRe: assert VS exceptions [modified] Pin
Sarath C28-May-06 22:27
Sarath C28-May-06 22:27 
QuestionUnicode controls for ANSI Build Pin
Neville Franks28-May-06 21:42
Neville Franks28-May-06 21:42 
AnswerRe: Unicode controls for ANSI Build Pin
<color>Aljechin 28-May-06 22:20
<color>Aljechin 28-May-06 22:20 
GeneralRe: Unicode controls for ANSI Build Pin
Neville Franks29-May-06 2:51
Neville Franks29-May-06 2:51 
QuestionMulti threaded programming Pin
Scorpio28-May-06 21:39
Scorpio28-May-06 21:39 
AnswerRe: Multi threaded programming Pin
Roger Stoltz28-May-06 21:50
Roger Stoltz28-May-06 21:50 
AnswerRe: Multi threaded programming Pin
Nibu babu thomas28-May-06 21:51
Nibu babu thomas28-May-06 21:51 
GeneralRe: Multi threaded programming Pin
ThatsAlok28-May-06 22:46
ThatsAlok28-May-06 22:46 
GeneralRe: Multi threaded programming Pin
Nibu babu thomas28-May-06 22:58
Nibu babu thomas28-May-06 22:58 
GeneralRe: Multi threaded programming Pin
ThatsAlok28-May-06 22:59
ThatsAlok28-May-06 22:59 
GeneralRe: Multi threaded programming Pin
Nibu babu thomas28-May-06 23:03
Nibu babu thomas28-May-06 23:03 
AnswerRe: Multi threaded programming Pin
Hamid_RT28-May-06 21:57
Hamid_RT28-May-06 21:57 
QuestionProblem with multi-splitters [modified] Pin
Member 303984328-May-06 21:13
Member 303984328-May-06 21:13 
AnswerRe: Problem with multi-splitters [modified] Pin
Nibu babu thomas28-May-06 21:48
Nibu babu thomas28-May-06 21:48 

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.