if i like (If)
uhm... which one would be better to use for a menu hack?
BTW these are random examples I made up...
switch -
if-else -Code:switch (x) { case 1: cout << "x is x"; break; case 2: cout << "x is xx"; break; default: cout << "value of x unknown"; }
YES I KNOW THEY ARE EQUIVALENT, BUT WHICH IS MORE EFFICIENT?Code:if (x == 1) { cout << "x is 1"; } else if (x == 2) { cout << "x is 2"; } else { cout << "value of x unknown"; }
Key:
= done
= not done
= working on it
= damn I killed it!
Accomplishments On MPGH:
make a mod -
make a gun to gun mod -
make a hack -
learn C++ -
roast a nub -
yeah, me too, but which is more efficient?
Key:
= done
= not done
= working on it
= damn I killed it!
Accomplishments On MPGH:
make a mod -
make a gun to gun mod -
make a hack -
learn C++ -
roast a nub -
Switch is faster...
k thx bai!
Key:
= done
= not done
= working on it
= damn I killed it!
Accomplishments On MPGH:
make a mod -
make a gun to gun mod -
make a hack -
learn C++ -
roast a nub -
you do understand the efficiency difference is so negligible that if you don't even know C++ the chances you''l be able to use it effectively are very slim and even if you did, it's quite pointless. Use whatever makes sense. Don't make nonsensical error-prone code to scrape out 1ms of a difference, your much more likely to cause memory leaks or repeatedly create large data structures on the stack instead of just accepting them as a parameter or global variable and other errors doing that and then that 1ms difference is pointless.
[IF] is more good for me!!
What why06jz said, He is right use the function that is suited to project and make sense.
I just like programming, that is all.
Current Stuff:
- GPU Programmer (Cuda)
- Client/Server (Cloud Server)
- Mobile App Development
Key:
= done
= not done
= working on it
= damn I killed it!
Accomplishments On MPGH:
make a mod -
make a gun to gun mod -
make a hack -
learn C++ -
roast a nub -
Switch allows you to fall through, if doesn't. That's about the only difference.
switch (crosshairType)
(
Case 3: // vertical + horiztaonl
// vertical
Case 2:
// horzintal
break;
Case 1: // vertical
//vertical
}
Typed on phone, sorry about the crap example.. I would have gown you a real code snippet of mine but yeah.
--" irrelevant. And sleeping DOES NOT stop memory leaks, only cleaning up after your shit does.
Adding Sleep inside of any D3D function hook might single handedly lag your hack to the point of being unusable.
I would only use switch statement when making a speed hack or some of the sort that has different speed/Values but other then that if statemant