Quote:Original post by d000hg
Yeah, technically you should have "NULL" and not "0", althugh I think "0" is nicer to look at.
Well technicall NULL is 0
Quote:Original post by d000hg
Yeah, technically you should have "NULL" and not "0", althugh I think "0" is nicer to look at.
Quote:Original post by furby100Quote:Original post by d000hg
Yes that's what you want.CBullet *CreateBulletIfFire(bool isFiring){ if(!isFiring) return NULL; else return new CBullet;}
Warning: Not all control paths return a value.
Remove the else and you'll be fine.
int *bleh(bool argh) { if (argh) return NULL; else return new int; }
Quote:Original post by furby100Quote:Original post by d000hg
Yes that's what you want.
CBullet *CreateBulletIfFire(bool isFiring)
{
if(!isFiring)
return NULL;
else
return new CBullet;
}
Warning: Not all control paths return a value.
Remove the else and you'll be fine.
Quote:Original post by furby100
My compiler doesn't like it.
Quote:Original post by furby100Quote:Original post by d000hg
Yes that's what you want.CBullet *CreateBulletIfFire(bool isFiring){ if(!isFiring) return NULL; else return new CBullet;}
Warning: Not all control paths return a value.
Remove the else and you'll be fine.
CBullet *CreateBulletIfFire(bool isFiring){ return (!isFiring ? NULL : new CBullet);}
Quote:Original post by Helter Skelter
Blah! Be a man!!!!CBullet *CreateBulletIfFire(bool isFiring){ return (!isFiring ? NULL : new CBullet);}
:)
return isFiring ? new CBullet : NULL;