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

Pages: 1-

whats this do

Name: Anonymous 2009-02-20 18:36

yo guys, just came across this mad piece of hardcore code, can anyone tell me what it does:

if(1) 1 ? 0 : 1;

Name: Anonymous 2009-02-20 18:47

if(1){
   if(1){
      0
   }
   else{
      1
   }
}

Name: Anonymous 2009-02-20 18:50

>>1
OMG WHATS THAT QUESTION MARK??? WHAT LANGUAGE IS THIS?????

Name: Anonymous 2009-02-20 18:50

It does nothing.

Name: Anonymous 2009-02-20 18:54

It returns zero.

Name: Anonymous 2009-02-20 20:36

Oh shit, I just saw a 2, someone check the Geiger counter!

Name: EXPERT C OPTIMIZER 2009-02-20 21:44

Since 0 and 1 are well-known constants you can optimize them out (thus resulting in if() ? : ;).

Name: Anonymous 2009-02-20 21:57

inline int question_mark_operator(int statement)
{
   if(statement)
      return 0;
   else
      return 1;
}

int main(int argc, char* argv[])
{
   if(1)
      question_mark_operator(1);
}

Name: Anonymous 2009-02-20 23:34

>>8
,s/question/exclamation/g

Name: Anonymous 2009-02-21 0:03

what language(s)?

Name: Anonymous 2009-02-21 0:13

Name: Anonymous 2009-02-21 0:36

Facepalm.

Name: Anonymous 2009-02-21 0:42


class ternary
{
public:
 ternary(int statement_) : statement(statement_) {}
 ternary() : statement(0) {}
 int question(int a, int b)
 {
  if(statement)
   return a;
  else return b;
 }
 
 int statement;
};


int main(int argc, char* argv[])
{
 ternary test(1);
 if(1)
  test.question(1);
}

Name: Anonymous 2009-02-21 0:44

>>13


class ternary
{
public:
 ternary(int statement_) : statement(statement_) {}
 ternary() : statement(0) {}
 int question(int a, int b)
 {
  if(statement)
   return a;
  else return b;
 }
 
 int statement;
};


int main(int argc, char* argv[])
{
 ternary test(1);
 if(1)
  test.question(0, 1);
}



fixd

Name: Anonymous 2009-02-21 0:48


class ternary
{
public:
 virtual int question(int statement) = 0;
};

class my_question : public ternary
{
public:
 int question(int statement)
 {
  if(statement)
   return 0;
  else return 1;
 }
};

void test_question(ternary* p)
{
 p->question(1);
}

int main(int argc, char* argv[])
{
 ternary* q = new my_question;
 if(1)
  test_question(q);
 delete q;
}

Name: Anonymous 2010-12-06 9:07

Back to /b/, ``GNAA Faggot''

Name: Anonymous 2013-01-19 23:48

/prog/ will be spammed continuously until further notice. we apologize for any inconvenience this may cause.

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