Click here to Skip to main content
16,007,760 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: A2WBSTR Pin
George_George3-Apr-08 21:27
George_George3-Apr-08 21:27 
GeneralRe: A2WBSTR Pin
CPallini3-Apr-08 22:38
mveCPallini3-Apr-08 22:38 
GeneralRe: A2WBSTR Pin
George_George3-Apr-08 23:04
George_George3-Apr-08 23:04 
GeneralRe: A2WBSTR Pin
CPallini3-Apr-08 23:15
mveCPallini3-Apr-08 23:15 
GeneralRe: A2WBSTR Pin
George_George3-Apr-08 23:18
George_George3-Apr-08 23:18 
GeneralRe: A2WBSTR Pin
CPallini3-Apr-08 23:29
mveCPallini3-Apr-08 23:29 
GeneralRe: A2WBSTR Pin
George_George3-Apr-08 23:32
George_George3-Apr-08 23:32 
Generalesoteric use of the "new" keyword Pin
Dave Calkins3-Apr-08 4:12
Dave Calkins3-Apr-08 4:12 
I came across this use of the "new" keyword in a library recently. I had to look it up to see what was going on. Apparently its valid, I've just never seen it before in any code examples, books, articles, etc.

If you write a custom new operator, you can write it to take an extra argument. When callers use the new keyword they supply an additional argument which gets passed to the new operator.

So you can call

MyClass* instance = new 128 MyClass;

This creates an instance of MyClass as expected but when invoking the custom new operator passes along the argument 128.

Anyway, I'm just curious if anyone else has seen or used this. It caught me off guard.
GeneralRe: esoteric use of the "new" keyword Pin
James R. Twine3-Apr-08 4:51
James R. Twine3-Apr-08 4:51 
QuestionRe: esoteric use of the "new" keyword Pin
David Crow3-Apr-08 4:56
David Crow3-Apr-08 4:56 
GeneralRe: esoteric use of the "new" keyword Pin
James R. Twine3-Apr-08 5:05
James R. Twine3-Apr-08 5:05 
GeneralRe: esoteric use of the "new" keyword Pin
Cedric Moonen3-Apr-08 5:10
Cedric Moonen3-Apr-08 5:10 
GeneralRe: esoteric use of the "new" keyword Pin
James R. Twine3-Apr-08 5:41
James R. Twine3-Apr-08 5:41 
GeneralRe: esoteric use of the "new" keyword Pin
Mark Salsbery3-Apr-08 6:10
Mark Salsbery3-Apr-08 6:10 
GeneralRe: esoteric use of the "new" keyword Pin
Dave Calkins3-Apr-08 11:18
Dave Calkins3-Apr-08 11:18 
GeneralRegCreateKeyEx failed in Vista Pin
dharani3-Apr-08 2:52
dharani3-Apr-08 2:52 
QuestionRe: RegCreateKeyEx failed in Vista Pin
Rajesh R Subramanian3-Apr-08 3:02
professionalRajesh R Subramanian3-Apr-08 3:02 
GeneralRe: RegCreateKeyEx failed in Vista Pin
Cedric Moonen3-Apr-08 3:14
Cedric Moonen3-Apr-08 3:14 
GeneralRe: RegCreateKeyEx failed in Vista Pin
David Crow3-Apr-08 3:18
David Crow3-Apr-08 3:18 
RantRe: RegCreateKeyEx failed in Vista Pin
James R. Twine3-Apr-08 5:43
James R. Twine3-Apr-08 5:43 
GeneralRe: RegCreateKeyEx failed in Vista Pin
Hamid_RT7-Apr-08 4:26
Hamid_RT7-Apr-08 4:26 
Generalerror C2664: '_access' : cannot convert parameter 1 from 'TCHAR [260]' to 'const char *' Pin
neha.agarwal273-Apr-08 2:03
neha.agarwal273-Apr-08 2:03 
GeneralRe: error C2664: '_access' : cannot convert parameter 1 from 'TCHAR [260]' to 'const char *' Pin
Cedric Moonen3-Apr-08 2:09
Cedric Moonen3-Apr-08 2:09 
Rantmap user to a group name Pin
vineeshV3-Apr-08 1:27
vineeshV3-Apr-08 1:27 
GeneralRe: map user to a group name Pin
David Crow3-Apr-08 3:23
David Crow3-Apr-08 3:23 

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.