Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

esthetic #define in C#

Name: Anonymous 2010-12-23 4:28


#define ALERT_NONE   (arr[0] <= 128)
#define ALERT_ORANGE (arr[0] >  128 && arr[1] <= 64)
#define ALERT_RED    (arr[0] >  128 && arr[1] >  64)
#define ALERT_NIGGER (arr[0] == 255 && arr[1] > 192)

if(ALERT_NONE)
  do_nothing();
else if(ALERT_ORANGE)
  panic_a_little();
else if(ALERT_RED)
  fuckshitwegonnadie();
else if(ALERT_NIGGER)
  back_to_b_please();


how do I do this in C#?

Name: Anonymous 2010-12-23 13:23

In any case you should rewrite it to something less stupid.
If you know your number is not less than or equal to 128, you shouldn't check if it's greater than 128 and certainly not twice.

I don't know your particular problem, but in many cases, it is both possible and better to rewrite if-then-else range problems and use a switch instead (integer division and modulo is your friend).

I hope you fucking die you faggot autistic nigger. It's not about this particular problem, it's just a shitty example, why can't you people ever learn this.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List