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

Criticize this code!

Name: Anonymous 2011-01-28 4:25

Do your best, /anus


/* code to establish a socket; originally from bzs@bu-cs.bu.edu
 */

int establish(unsigned short portnum)
{ char   myname[MAXHOSTNAME+1];
  int    s;
  struct sockaddr_in sa;
  struct hostent *hp;

  memset(&sa, 0, sizeof(struct sockaddr_in)); /* clear our address */
  gethostname(myname, MAXHOSTNAME);           /* who are we? */
  hp= gethostbyname(myname);                  /* get our address info */
  if (hp == NULL)                             /* we don't exist !? */
    return(-1);
  sa.sin_family= hp->h_addrtype;              /* this is our host address */
  sa.sin_port= htons(portnum);                /* this is our port number */
  if ((s= socket(AF_INET, SOCK_STREAM, 0)) < 0) /* create socket */
    return(-1);
  if (bind(s,&sa,sizeof(struct sockaddr_in)) < 0) {
    close(s);
    return(-1);                               /* bind address to socket */
  }
  listen(s, 3);                               /* max # of queued connects */
  return(s);
}

Name: Anonymous 2011-01-28 16:58

/prog/ COCK Obfuscated Code KDEontest

Write the most obfuscated and expensive code to return 0 in C.
No infinite loops/gotos are allowed, the code MUST return, it can't segfault or stack overflow either (that's why you can't use haskell).
No side effects, you can just do computations.

The winner will be decided with the formula leah_culver.round(leah_culver.star_rate(obfuscation_vote)*leah_culver.star_rate(execution_time_in_seconds/10)+(bonus_points*2.5));

You'll get 10 bonus points depending if your code looks like a piece of art or a piece of shit.

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