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

Pages: 1-

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 4:32

You just use c[spoiler][code]o[spoiler][code]n[spoiler][code]s[spoiler][code]t[/code][/code][/code][/code][/spoiler][/spoiler][/spoiler][/spoiler]

Name: Anonymous 2010-12-23 4:32

>>2
*c[spoiler][code]o[spoiler][code]n[spoiler][code]s[spoiler][code]t[/code][/spoiler][/code][/spoiler][/code][/spoiler][/code][/spoiler]

Name: Anonymous 2010-12-23 4:33

>>3
*const

Name: Anonymous 2010-12-23 4:39

co[spoiler][code]n[spoiler][code]s[spoiler][code]t[/code][/spoiler][/code][/spoiler][/code][/spoiler]

Name: Anonymous 2010-12-23 5:27

i don't think you can, it breaks object oriented-ness.

Name: Anonymous 2010-12-23 5:50

>>6
it breaks object oriented-ness.
How.

Name: Anonymous 2010-12-23 5:57

>>7
Defined stuff aren't objects.

Name: Anonymous 2010-12-23 5:58

>>7
definitions have global scope, they aren't contained at all.
the closest thing you could get is constant class variables.

Name: Anonymous 2010-12-23 6:03

Preprocessor is a layer above OOP. That's the same as saying that search-and-replace isn't OOP. The next thing they'll tell us is how not using Visual Studio §§breaks object oriented-ness''

Name: Anonymous 2010-12-23 6:10

>>10
Why would anybody program in C# an NOT use VS?

Name: Anonymous 2010-12-23 6:44

>>11
Because ED is the standard editor, VS is bloated shit.

Name: Anonymous 2010-12-23 6:59

>>12
The autism is strong in this post.

Name: Anonymous 2010-12-23 7:04

>>13
The acustic is strong in this post.

Name: Anonymous 2010-12-23 7:18

>>13
Bitch tits are strong in this post, more like.

Name: Anonymous 2010-12-23 9:01

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Name: Anonymous 2010-12-23 9:33

Easy as my anus

public bool ALERT_NONE { get { return (arr[0] <= 128); }}
public bool ALERT_ORANGE { get { return (arr[0] >  128 && arr[1] <= 64); }}
public bool ALERT_RED { get { return (arr[0] >  128 && arr[1] >  64); }}
public bool ALERT_NIGGER { get { return (arr[0] == 255 && arr[1] > 192)
; }}

Name: Anonymous 2010-12-23 9:50

>>17
The hell is get { }?

Name: Anonymous 2010-12-23 9:58

>>18
a GET is...

Name: >>19 2010-12-23 9:58

>>18
20 GET!

Name: Anonymous 2010-12-23 12:24

>>17
Not so easy when arr isn't global, autism boy.

Name: Anonymous 2010-12-23 12:32

>>21
Only an autist would contain state locally in the object whose messages made use of it, clearly.

Name: Anonymous 2010-12-23 13:21

>>1
If you want defines, then use another language.
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).

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.

Name: Anonymous 2010-12-23 13:34

>>24
U MAD NIGGA

Name: Anonymous 2010-12-23 13:58

>>24
Perhaps it would be better to clarify why you want to use defines, instead of writing very bad code.
That way I'll be able to tell you why you're wrong to use them.

Name: Anonymous 2011-02-22 5:55

>>1
Have you considered accepting an answer or starting a bounty for this question?

Name: Anonymous 2011-02-22 6:14

HIDE THREAD: cancer

Name: Anonymous 2011-02-22 7:38

>>24
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.

Lisen nigga, u think "I will use #define" now u have 2 problems. Coz all times u want to do that it would be a "shitty problem" nigga. U make an example, it's shitty, u make another example, it's shitty, y u no lrn nigga?

Name: Anonymous 2011-02-22 12:04

>>29
mailto:noko
Tsk

Name: Anonymous 2011-02-22 12:44

>>28
cancer
HIDE POST: imageboard retard

Name: Anonymous 2011-02-22 14:58

>>31
fuck off faggot

Name: Anonymous 2011-02-22 14:58

fuck off dubs

Name: Anonymous 2011-02-22 17:34

>>30
mailto:noko
Tsk.

Name: Anonymous 2011-02-22 20:11

>>34
mailto:noko
Tsk.

Tsk.

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