You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I wasn't clear enough previously.
Either I know the pointer can only be valid or NULL. Then I will just use : if(ptr!=NULL) ...
But sometimes the pointer can be different of NULL and be invalid (as you have showed), then I will use the "full"
I don't like to use because it's unclear and I don't know what is really done (I don't trust the documentation).
I thought about that too at first, but then I realized that when (pointerObj!=NULL), CheckPointer() won't be called. It seems like a unified check for all cases.
So you are suggesting to not use the if shortcut ?
I understand the concept behind what you said but I can hardly believe it's useful in practice (about if shortcut like here).
Though I would be happy to learn I am wrong. Are you able to demonstrate the impact ? (not necessarily with pointer==NULL, I don't care).
"do my stuff" usually means pointer accesses, so you have branching either way.
I thought about that too at first, but then I realized that when (pointerObj!=NULL), CheckPointer() won't be called. It seems like a unified check for all cases.
"do my stuff" usually means pointer accesses, so you have branching either way.
Its the other way around for || because the result is already defined at that point.
Yes, || looks more attractive
Yes, || looks more attractive