Click here to Skip to main content
15,887,596 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How do we cast void type Pin
Victor Nijegorodov10-Feb-18 10:01
Victor Nijegorodov10-Feb-18 10:01 
AnswerRe: How do we cast void type Pin
jschell10-Feb-18 6:40
jschell10-Feb-18 6:40 
GeneralRe: How do we cast void type Pin
luplup10-Feb-18 8:03
luplup10-Feb-18 8:03 
QuestionRe: How do we cast void type Pin
Victor Nijegorodov10-Feb-18 8:25
Victor Nijegorodov10-Feb-18 8:25 
GeneralRe: How do we cast void type Pin
luplup10-Feb-18 8:32
luplup10-Feb-18 8:32 
GeneralRe: How do we cast void type Pin
Richard MacCutchan10-Feb-18 9:58
mveRichard MacCutchan10-Feb-18 9:58 
GeneralRe: How do we cast void type Pin
jschell13-Feb-18 14:48
jschell13-Feb-18 14:48 
AnswerRe: How do we cast void type Pin
Victor Nijegorodov10-Feb-18 8:39
Victor Nijegorodov10-Feb-18 8:39 
  1. Could you explain what are you trying to achieve using such type of very dangerous castings?
  2. luplup wrote:
    void calc(void *var) {
    //try convert short to int with new var
    int tmp = (int)var;
    printf("tmp: %i\n", tmp);//bad, must be 30002
    //try cast/convert original var
    (int)var += 30003;
    }

    The problem with this "casting" is the origin of the parameter passed to is short integer (the low WORD in Win32 environment).
    But you are then trying to interpret it (somehow) as int causing to take into account the high WORD which contain garbage!
    So what do you expect from the next manipulations with this garbage? Sleepy | :zzz:
Well "4 days" for such a trial & error method is more than enough to understand (what you should have done for a couple of hours if you properly used a debugger) that such a "simple" casting in a real C/C++ code is very very dangerous and should be avoided!
GeneralRe: How do we cast void type Pin
luplup10-Feb-18 8:56
luplup10-Feb-18 8:56 
GeneralRe: How do we cast void type Pin
Victor Nijegorodov10-Feb-18 9:54
Victor Nijegorodov10-Feb-18 9:54 
AnswerRe: How do we cast void type Pin
Victor Nijegorodov10-Feb-18 10:05
Victor Nijegorodov10-Feb-18 10:05 
QuestionWhat is the two-finger scroll event (MFC app)? Pin
Alan Balkany8-Feb-18 17:18
Alan Balkany8-Feb-18 17:18 
AnswerRe: What is the two-finger scroll event (MFC app)? Pin
Randor 8-Feb-18 20:25
professional Randor 8-Feb-18 20:25 
AnswerRe: What is the two-finger scroll event (MFC app)? Pin
Richard MacCutchan8-Feb-18 22:48
mveRichard MacCutchan8-Feb-18 22:48 
Questionchange exe path Pin
Fedrer7-Feb-18 20:14
Fedrer7-Feb-18 20:14 
AnswerRe: change exe path Pin
Richard MacCutchan7-Feb-18 22:11
mveRichard MacCutchan7-Feb-18 22:11 
GeneralRe: change exe path Pin
Fedrer8-Feb-18 18:34
Fedrer8-Feb-18 18:34 
GeneralRe: change exe path Pin
Randor 8-Feb-18 20:00
professional Randor 8-Feb-18 20:00 
GeneralRe: change exe path Pin
Richard MacCutchan8-Feb-18 22:41
mveRichard MacCutchan8-Feb-18 22:41 
QuestionWhat IDE do you use for C/C++ development? Pin
Davide Coppola6-Feb-18 23:31
Davide Coppola6-Feb-18 23:31 
AnswerRe: What IDE do you use for C/C++ development? Pin
CPallini6-Feb-18 23:49
mveCPallini6-Feb-18 23:49 
GeneralRe: What IDE do you use for C/C++ development? Pin
Davide Coppola6-Feb-18 23:52
Davide Coppola6-Feb-18 23:52 
QuestionRe: What IDE do you use for C/C++ development? Pin
CPallini7-Feb-18 0:00
mveCPallini7-Feb-18 0:00 
AnswerRe: What IDE do you use for C/C++ development? Pin
Davide Coppola7-Feb-18 0:14
Davide Coppola7-Feb-18 0:14 
AnswerRe: What IDE do you use for C/C++ development? Pin
Richard MacCutchan7-Feb-18 0:44
mveRichard MacCutchan7-Feb-18 0:44 

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.