I saw this appropriately named function in a game:
ejectShitFromMyAssAndDie()
It did what I expected it to do.
I saw this appropriately named function in a game:
ejectShitFromMyAssAndDie()
It did what I expected it to do.
From a Kinect Game i was refactoring.
The level had a fixed size and you were moving through kind of a tube, only capable of strafing and adjusting your speed.
Player.Score += (int)(60f * Player.Velocity.Length() * gameTime.GetDelta());
"Equal to" and "of the same type" ... bit redundant .
Maybe, but at least that prevents surprises from numerical conversions and weird interactions between $pass and the string if $pass is some other type. It gets really screwy:
http://php.net/manual/en/types.comparisons.php
I don't remember if it was === or == actually, it could have been ==, it was long ago and that person wasn't a programmer.
My favorites are always static analyzer stuff. Frequently annotated with "//to shut up the static analyzer". I can't think of any recent examples though.
I knew a guy who wrapped some code that would never be reached in:
if (superman > batman){
//some code
}
I have once seen a junior colegue of mine do a gentle modification
if (l.code==86)
{
....
}
// jan grubenar #
if (l.code==86)
{
....
}
// jan grubenar *
after a little chit chat he resulted into
if (l.code==86)
{
....
// jan grubenar # (please do not write after this code but before it!)
....
// jan grubenar *
}
(this is rather not exact but it shadely describes it)
I think by now I want a version of C++ that doesn't do any automatic type conversions at all. !0 is the int 1, and you shouldn't be allowed to assign that to a char without an explicit cast.
I have once seen a junior colleague of mine do a gentle modification
if (l.code==86) { .... } // jan grubenar # if (l.code==86) { .... } // jan grubenar *
.
This person did not know what a while loop was ?
.
boolean run = true;
while (run){
if (l.code == 86){
//do stuff
{
{
I think by now I want a version of C++ that doesn't do any automatic type conversions at all. !0 is the int 1, and you shouldn't be allowed to assign that to a char without an explicit cast.
Without any implicit conversions then !0 wouldn't compile either since ! is a logical operator (not a bitwise operator) and integers are not booleans.
Likewise, "if(i)" (where i is an integer) should be an error instead requiring the explicit "if(i!=0)" if you want to be strict about conversions.
Also note that outright banning implicit conversions would also mean that conversions to references would be disallowed or from non-const/volatile to const/volatile or back though I'd assume you meant to give those implicit conversions a pass.
Not really. I have a scripting language where the only implicit casts allowed are: derived->base or pointer-compare-to-null. Notably, integers don't auto convert to bools. It stings me regularly every time I compile something with an if(integer) inside. It's not just a matter of being used to C/C++ autocasting feature. It's just more compact notation.
That seems desirable to me.