Click here to Skip to main content
15,888,816 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: RAII Theory Pin
Stephen Hewitt22-Mar-13 21:17
Stephen Hewitt22-Mar-13 21:17 
GeneralRe: RAII Theory Pin
pasztorpisti23-Mar-13 1:06
pasztorpisti23-Mar-13 1:06 
GeneralRe: RAII Theory Pin
Stephen Hewitt24-Mar-13 8:27
Stephen Hewitt24-Mar-13 8:27 
GeneralRe: RAII Theory Pin
pasztorpisti24-Mar-13 8:44
pasztorpisti24-Mar-13 8:44 
GeneralRe: RAII Theory Pin
pasztorpisti24-Mar-13 8:52
pasztorpisti24-Mar-13 8:52 
QuestionFunction pointer Pin
Marco Bertschi21-Mar-13 0:10
protectorMarco Bertschi21-Mar-13 0:10 
AnswerRe: Function pointer Pin
Richard MacCutchan21-Mar-13 0:51
mveRichard MacCutchan21-Mar-13 0:51 
GeneralRe: Function pointer Pin
Marco Bertschi21-Mar-13 1:06
protectorMarco Bertschi21-Mar-13 1:06 
GeneralRe: Function pointer Pin
Richard Andrew x6421-Mar-13 1:57
professionalRichard Andrew x6421-Mar-13 1:57 
GeneralRe: Function pointer Pin
Marco Bertschi21-Mar-13 2:16
protectorMarco Bertschi21-Mar-13 2:16 
GeneralRe: Function pointer Pin
Freak3021-Mar-13 2:30
Freak3021-Mar-13 2:30 
GeneralRe: Function pointer Pin
Marco Bertschi21-Mar-13 2:36
protectorMarco Bertschi21-Mar-13 2:36 
GeneralRe: Function pointer Pin
dusty_dex21-Mar-13 4:21
dusty_dex21-Mar-13 4:21 
GeneralRe: Function pointer Pin
Richard MacCutchan21-Mar-13 3:28
mveRichard MacCutchan21-Mar-13 3:28 
Yes you could do that (you need int (*DoTaks)(void*); notation), but you still have the problem that any mistakes with the parameters cannot be spotted by the compiler. If you are happy to live with that risk then go ahead; a small prototype should help to clarify the issues you may face. Something like:
C++
struct aStruct
{
    int value;
    char someText[12];
};

int func1(int pvParameters[3])
{
    // do something with the parameters
    return 1;
}

int func2(aStruct* paStruct)
{
    // do something with the parameters
    return 2;
}

void DoTest()
{
    int myArray[] = { 1, 2, 3 };
    aStruct myStruct = { 5, "data" };

    int (*DoFunc)(void*);
    
    DoFunc = (int (*)(void*))func1;
    int r = DoFunc((void*)myArray);
    
    DoFunc = (int (*)(void*))func2;
    int r2 = DoFunc((void*)&myStruct);
    
}

Use the best guess

QuestionProblem regarding to array in C++ Pin
achylast20-Mar-13 22:00
achylast20-Mar-13 22:00 
AnswerRe: Problem regarding to array in C++ Pin
Richard MacCutchan20-Mar-13 22:48
mveRichard MacCutchan20-Mar-13 22:48 
QuestionRe: Problem regarding to array in C++ Pin
achylast25-Mar-13 15:36
achylast25-Mar-13 15:36 
AnswerRe: Problem regarding to array in C++ Pin
Richard MacCutchan25-Mar-13 23:31
mveRichard MacCutchan25-Mar-13 23:31 
AnswerRe: Problem regarding to array in C++ Pin
Marco Bertschi21-Mar-13 0:12
protectorMarco Bertschi21-Mar-13 0:12 
QuestionWinsock Error 10035 Pin
john563220-Mar-13 19:26
john563220-Mar-13 19:26 
AnswerRe: Winsock Error 10035 Pin
Jochen Arndt20-Mar-13 22:09
professionalJochen Arndt20-Mar-13 22:09 
GeneralRe: Winsock Error 10035 Pin
john563220-Mar-13 22:43
john563220-Mar-13 22:43 
GeneralRe: Winsock Error 10035 Pin
Jochen Arndt20-Mar-13 23:03
professionalJochen Arndt20-Mar-13 23:03 
QuestionDirectShow is a flop – any other video library out there? Pin
Vaclav_20-Mar-13 17:06
Vaclav_20-Mar-13 17:06 
AnswerRe: DirectShow is a flop – any other video library out there? Pin
SoMad20-Mar-13 19:04
professionalSoMad20-Mar-13 19:04 

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.