Criticize this code!
1
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);
}
2
Name:
Anonymous
2011-01-28 4:29
return(-1);
return(s);
return(...);
throw new java.lang.ExceptionFactoryFactory.ExceptionFactory.Exception.StyleException.StyleError.StyleErrorError;
3
Name:
Anonymous
2011-01-28 4:40
Did FrozenVoid write this?
4
Name:
Anonymous
2011-01-28 4:41
>>3
It doesn't
#include "void.h" //handles all the common functions,#defines,#ifdefs and #includes
5
Name:
Anonymous
2011-01-28 9:04
>>2
That's not too bad. Those are exceptional cases, and the returns appear on their own line which is all I ask for.
>>3
Take a look at void.h and tell me whether you think FV wrote this.
6
Name:
Anonymous
2011-01-28 9:07
>>5
That wasn't the issue in
>>2 .
7
Name:
Anonymous
2011-01-28 9:46
>>5
return is not a function, parentheses like a function call for
return considered harmful
8
Name:
Anonymous
2011-01-28 10:40
>>6-7
Oh, well I'm all for parenthesizing expressions provided it's not overdone. It didn't even occur to me that it might be an issue. (
return-visibility is a far more important topic) but now that you bring it up, there ought to be a space.
9
Name:
Anonymous
2011-01-28 10:44
>>8
Those parens are
superfluos and irritating, and I'm a
fucking Lisper .
return should be
return expr;, there is
no need to put those
stupid fucking parentheses there.
GODFUQINDAMN
10
Name:
Anonymous
2011-01-28 13:07
>>2,7,9
Fuck you, faggot. From now on I'll use those fucking parentheses in my code all the time just to make fucking faggots like you cringe. Enjoy yo'ure gay.
11
Name:
Anonymous
2011-01-28 13:19
<--- check em dubz
12
Name:
Anonymous
2011-01-28 13:35
check<--- check em dubz in base11
13
Name:
Anonymous
2011-01-28 13:36
>>9
Now we must add more parentheses for certain!
14
Name:
Anonymous
2011-01-28 14:05
>>13
int main()
{
return(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((0)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))));
}
15
Name:
Anonymous
2011-01-28 16:15
>>14
Needs more braces and semicolons too.
16
Name:
Anonymous
2011-01-28 16:34
>>15
main(){{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;return(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((0+0-0*0+0+0+0-0+0-0+0+-0+0)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
17
Name:
Anonymous
2011-01-28 16:36
>>16
Now this is source code I can get behind.
18
Name:
Anonymous
2011-01-28 16:58
/prog/ COCK Obfuscated Code KDE ontest
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.
19
Name:
Anonymous
2011-01-29 1:09
>>18
int main()
{
return 0;
}
I am currently the best (and only) participant.
20
Name:
Anonymous
2011-01-29 1:29
>>18
start a new thread ,
``faggot'' .
21
Name:
Anonymous
2011-01-29 1:52
22
Name:
Anonymous
2011-01-29 3:05
>>1
when I look at the code sideways, it doesn't seem to be indented properly...
23
Name:
Anonymous
2011-01-29 8:01
Submission
#define can int
#define you main()
#define please {
#define thank ;
#define you }
can you please return 0 thank you
24
Name:
Anonymous
2011-01-29 8:07
>>23
I feel some INTERCAL coming on.
25
Name:
Anonymous
2011-01-29 8:17
{ char myname[MAXHOSTNAME+1];
faggot style. Should add newline after {
hp= gethostbyname(myname); /* get our address info */
Faggot style. No space before = or redundant space after =. Either two spaces or zero.
return(-1);
This is not lisp. Return is not a function.
sa.sin_family= hp->h_addrtype; /* this is our host address */
Replace with AF_INET as you did in socket(2). Remove gethost* calls completely
sa.sin_family= hp->h_addrtype; /* this is our host address */
Incorrect comment. This is not address.You wanted
sa.sin_addr.s_addr = INADDR_ANY
instead. Or at least h_addr
listen(s, 3);
Check return value.
Overall rate:
Style: 2/5
Bug-free: 1/5
Comments: 1/5
Overall: 1/5
26
Name:
Anonymous
2011-01-29 8:37
return(-1);
This is not lisp. Return is not a function.
That wouldn't be lisp. Return does not exist.
27
Name:
Anonymous
2011-01-29 10:32
>>26
(RETURN-FROM my anus)
28
Name:
Anonymous
2011-02-03 2:38