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

C / C++ / MFC

 
QuestionUsing a static library (.a) build with gcc Pin
KNSetting4-Sep-09 2:00
KNSetting4-Sep-09 2:00 
AnswerRe: Using a static library (.a) build with gcc Pin
Stuart Dootson4-Sep-09 2:35
professionalStuart Dootson4-Sep-09 2:35 
AnswerRe: Using a static library (.a) build with gcc Pin
KNSetting4-Sep-09 6:59
KNSetting4-Sep-09 6:59 
GeneralRe: Using a static library (.a) build with gcc Pin
Stuart Dootson4-Sep-09 8:52
professionalStuart Dootson4-Sep-09 8:52 
GeneralRe: Using a static library (.a) build with gcc Pin
KNSetting8-Sep-09 1:29
KNSetting8-Sep-09 1:29 
Questionconverting if else ladder Pin
hrishiS4-Sep-09 1:32
hrishiS4-Sep-09 1:32 
AnswerRe: converting if else Pin
David Crow4-Sep-09 2:13
David Crow4-Sep-09 2:13 
GeneralRe: converting if else Pin
hrishiS4-Sep-09 2:22
hrishiS4-Sep-09 2:22 
Hi
I want to change the "if and else" statement of the following code in to a different fashion,(not with if and else ladder)

what i want to achieve with the code is: Any one of the pointers (p1,p2,p3) will be non NULL...at any given time. (For the time being I am hard-coding with the address of value i, but in actual I may be passing the i value to the function) Others will be NULL for sure...i need to check which is not NULL...that's it

Note: I would be using dynamic_cast, to assign the i value later..... [dynamic_cast returns 0, if cast was not happened ]

int i=10;
int *p1=NULL;
int *p2=&i;
int *p3=NULL;
if(p1!=NULL)
{
printf("\n\np1");
}
else if(p2!=NULL)
{
printf("\n\np2");
}
else if(p3!=NULL)
{
printf("\n\np3");
}
else
{
printf("\n\nnone");
}

thanks

-----------------------------
I am a beginner

QuestionRe: converting if else Pin
David Crow4-Sep-09 3:13
David Crow4-Sep-09 3:13 
GeneralRe: converting if else Pin
Iain Clarke, Warrior Programmer4-Sep-09 3:14
Iain Clarke, Warrior Programmer4-Sep-09 3:14 
GeneralRe: converting if else Pin
bob169724-Sep-09 4:17
bob169724-Sep-09 4:17 
AnswerRe: converting if else ladder Pin
Joe Woodbury4-Sep-09 8:22
professionalJoe Woodbury4-Sep-09 8:22 
Generalmemory leaks Pin
Agavriloaie Constantin3-Sep-09 23:06
Agavriloaie Constantin3-Sep-09 23:06 
GeneralRe: memory leaks Pin
iraclyKv4-Sep-09 2:13
iraclyKv4-Sep-09 2:13 
GeneralRe: memory leaks Pin
Agavriloaie Constantin4-Sep-09 3:29
Agavriloaie Constantin4-Sep-09 3:29 
GeneralRe: memory leaks Pin
David Crow4-Sep-09 2:17
David Crow4-Sep-09 2:17 
GeneralRe: memory leaks Pin
Agavriloaie Constantin4-Sep-09 3:25
Agavriloaie Constantin4-Sep-09 3:25 
GeneralRe: memory leaks Pin
David Crow4-Sep-09 3:43
David Crow4-Sep-09 3:43 
Questionany body have codejock skin? Pin
zhanghui54323-Sep-09 21:53
zhanghui54323-Sep-09 21:53 
AnswerRe: any body have codejock skin? Pin
Rajesh R Subramanian4-Sep-09 0:38
professionalRajesh R Subramanian4-Sep-09 0:38 
QuestionSaving icon to PNG file (GDI+)? Pin
akirilov3-Sep-09 21:40
akirilov3-Sep-09 21:40 
AnswerRe: Saving icon to PNG file (GDI+)? Pin
Richard MacCutchan4-Sep-09 5:51
mveRichard MacCutchan4-Sep-09 5:51 
AnswerRe: Saving icon to PNG file (GDI+)? Pin
akirilov6-Sep-09 20:22
akirilov6-Sep-09 20:22 
GeneralRe: Saving icon to PNG file (GDI+)? Pin
kilt7-Sep-09 5:04
kilt7-Sep-09 5:04 
GeneralRe: Saving icon to PNG file (GDI+)? Pin
akirilov7-Sep-09 23:38
akirilov7-Sep-09 23:38 

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.