Click here to Skip to main content
15,911,531 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MFC new should throw Pin
bob1697210-Nov-11 3:49
bob1697210-Nov-11 3:49 
GeneralRe: MFC new should throw Pin
Richard MacCutchan10-Nov-11 6:21
mveRichard MacCutchan10-Nov-11 6:21 
GeneralRe: MFC new should throw Pin
bob1697210-Nov-11 7:28
bob1697210-Nov-11 7:28 
GeneralRe: MFC new should throw Pin
Richard MacCutchan10-Nov-11 11:27
mveRichard MacCutchan10-Nov-11 11:27 
GeneralRe: MFC new should throw Pin
bob1697210-Nov-11 15:56
bob1697210-Nov-11 15:56 
AnswerRe: MFC new should throw Pin
Chuck O'Toole10-Nov-11 16:41
Chuck O'Toole10-Nov-11 16:41 
GeneralRe: MFC new should throw Pin
bob1697210-Nov-11 21:11
bob1697210-Nov-11 21:11 
AnswerRe: MFC new should throw Pin
Chuck O'Toole11-Nov-11 1:57
Chuck O'Toole11-Nov-11 1:57 
So I went into Visual Studio 2008 and found some code that uses new and hit 'F1' and received this tidbit:

Quote:
Remarks
This form of operator new is known as scalar new, in contrast to the vector new form (operator new[]).

The first form of this operator is known as the nonplacement form. The second form of this operator is known as the placement form and the third form of this operator is the nonthrowing, placement form.

The first form of the operator is defined by the compiler and does not require new.h to be included in your program.

operator delete frees memory allocated with operator new.

You can configure whether operator new returns null or throws an exception on failure. See The new and delete Operators for more information.

With the exception of throwing or no-throwing behavior, the CRT operator new behaves like operator new in the Standard C++ Library.


So, since you can apparently configure the action on failure, I'm guessing that the MFC / Wizard code is defending against the case where it *doesn't* throw an exception (wow, now I'm channelling Bill Gates).

I didn't follow the links to *how* one would configure the behavior or what the default behavior is now-a-days. I suggest you set the behavior the way you want it (or take the default) and write your code accordingly.
GeneralRe: MFC new should throw Pin
bob1697211-Nov-11 14:53
bob1697211-Nov-11 14:53 
GeneralRe: MFC new should throw Pin
Richard MacCutchan10-Nov-11 21:32
mveRichard MacCutchan10-Nov-11 21:32 
GeneralRe: MFC new should throw Pin
bob1697211-Nov-11 15:01
bob1697211-Nov-11 15:01 
AnswerRe: MFC new should throw Pin
Stefan_Lang10-Nov-11 2:13
Stefan_Lang10-Nov-11 2:13 
GeneralRe: MFC new should throw Pin
Orjan Westin10-Nov-11 3:28
professionalOrjan Westin10-Nov-11 3:28 
GeneralRe: MFC new should throw Pin
Stefan_Lang10-Nov-11 3:35
Stefan_Lang10-Nov-11 3:35 
Questiondev-c++ Pin
RealHigh9-Nov-11 9:25
RealHigh9-Nov-11 9:25 
AnswerRe: dev-c++ Pin
Richard Andrew x649-Nov-11 9:35
professionalRichard Andrew x649-Nov-11 9:35 
GeneralRe: dev-c++ Pin
Albert Holguin9-Nov-11 9:36
professionalAlbert Holguin9-Nov-11 9:36 
GeneralRe: dev-c++ Pin
RealHigh9-Nov-11 12:04
RealHigh9-Nov-11 12:04 
AnswerRe: dev-c++ Pin
Albert Holguin9-Nov-11 9:35
professionalAlbert Holguin9-Nov-11 9:35 
AnswerRe: dev-c++ Pin
Chris Meech9-Nov-11 9:43
Chris Meech9-Nov-11 9:43 
QuestionRe: dev-c++ Pin
David Crow9-Nov-11 10:06
David Crow9-Nov-11 10:06 
AnswerRe: dev-c++ Pin
RealHigh9-Nov-11 13:04
RealHigh9-Nov-11 13:04 
QuestionSign XML Documents with Digital Signatures Pin
dufduf9-Nov-11 2:58
dufduf9-Nov-11 2:58 
Questionplaying video inside any control on my dialog box using direct show??? Pin
VCProgrammer9-Nov-11 0:17
VCProgrammer9-Nov-11 0:17 
AnswerRe: playing video inside any control on my dialog box using direct show??? Pin
Mark Salsbery9-Nov-11 5:20
Mark Salsbery9-Nov-11 5:20 

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.