/* Anonix.h - A set of common functions for the Anonix operating system. Copyright: none. Public Domain. Written by Anonymous. United by one. Divided by zero. We do not forgive nor forget. Expect us. */
const int ZERO = 0;
int isequalto(int x,int y){return x==y;}
int isnotequalto(int x,int y){return !isequalto(x, y);}
int islessthan(int x,int y){return x<y;}
int islessthanorequalto(int x,int y){return islessthan(x, y) || isequalto(x, y);}
int isgreaterthan(int x,int y){return x>y;}
int isgreaterthanorequalto(int x,int y){return isgreaterthan(x, y) || isequalto(x, y);}
int isnegative(int x){return islessthan(x, ZERO);}
int ispositive(int x){return isgreaterthanorequalto(x, ZERO);}
int iszero(int x){return isequalto(x, ZERO);}
int isnotzero(int x){return isnotequalto(x, ZERO);}
int dividebyzero(int x){return x/ZERO;}
Symbols starting with __ are reserved for implementations. Non-inline functions really shouldn't be defined in headers. Variables really shouldn't be defined in headers. These functions are useless and counter-productive. The last four sentences of the comment are silly.
Name:
Anonymous2011-08-07 15:39
>>2 Symbols starting with __ are reserved for implementations.
Such as ... ANONIX ?
#ifndef BOOLS_H
#define BOOLS_H
#define ZERO 0
/* ANONIX.H - version 1.01 - A set of common functions for the Anonix operating system. Copyright: none. Public Domain. Written by Anonymous. United by one. Divided by zero. We do not forgive nor forget. Expect us. CHANGELOG: deleted excessive whitespace, one of the known leading causes of bloat in the GNU coreutils. Removed symbols starting with __ which are reserved for implementations. Made functions inline. The functions are now useful and productive. The last four sentences
* in the comments are no longer silly. */
inline int isequalto(int x,int y){return x==y;}
inline int isnotequalto(int x,int y){return !isequalto(x,y);}
inline int islessthan(int x,int y){return x<y;}
inline int islessthanorequalto(int x,int y){return islessthan(x,y)||isequalto(x,y);}
inline int isgreaterthan(int x,int y){return x>y;}
inline int isgreaterthanorequalto(int x,int y){return isgreaterthan(x,y)||isequalto(x,y);}
inline int isnegative(int x){return islessthan(x,ZERO);}
inline int ispositive(int x){return isgreaterthanorequalto(x,ZERO);}
inline int iszero(int x){return isequalto(x,ZERO);}
inline int isnotzero(int x){return isnotequalto(x,ZERO);}
inline int dividebyzero(int x){const int Z=ZERO;return x/Z;}
#endif
>>6,9
Oh boy, because we sure need slow as dog shit versions of the core unix utils that run 50 times slower than the C versions.
Name:
Cudder!MhMRSATORI2011-08-07 17:49
dbz.c
#include <stdio.h>
#include "anonix.h"
int main(int argc,char *argv[]){
int i;
if(isequalto(argc,1)){
puts("Divides arguments by zero.");
printf("Usage: %s INTEGER [INTEGER, INTEGER, INTEGER, ...]\n",argv[0]);
}
for(i=1;i<argc;i++){
int x=atoi(argv[i]);
printf("%d\n",dividebyzero(x));
}
return 0;
}
Name:
Anonymous2011-08-07 17:50
Isn't there a serious implementation of unix core utils written in Perl? I think they wanted it so that they could have some sort of standard accross a wide variety of OS's.
``It is easier to port a shell than a shell script.'' --Larry Wall
Name:
CUDDERfan2011-08-07 18:31
>>10
You have a point. I ditched the Python version and wrote echo[/echo] in Bash.
[code]#!/bin/sh
echo $@
Here are the benchmarks:
GNU
$ time echo Have you read your SICP today?
Have you read your SICP today?
real 0m0.000s
user 0m0.000s
sys 0m0.000s
$ time echo Have you read your SICP today?
Have you read your SICP today?
real 0m0.000s
user 0m0.000s
sys 0m0.000s
$ time echo Have you read your SICP today?
Have you read your SICP today?
real 0m0.000s
user 0m0.000s
sys 0m0.000s
$ time echo Have you read your SICP today?
Have you read your SICP today?
real 0m0.000s
user 0m0.000s
sys 0m0.000s
$ time echo Have you read your SICP today?
Have you read your SICP today?
real 0m0.000s
user 0m0.000s
sys 0m0.000s
Anonix
$ time ./echo Have you read your SICP today?
Have you read your SICP today?
real 0m0.005s
user 0m0.000s
sys 0m0.000s
$ time ./echo Have you read your SICP today?
Have you read your SICP today?
real 0m0.005s
user 0m0.000s
sys 0m0.000s
$ time ./echo Have you read your SICP today?
Have you read your SICP today?
real 0m0.005s
user 0m0.004s
sys 0m0.000s
$ time ./echo Have you read your SICP today?
Have you read your SICP today?
real 0m0.005s
user 0m0.000s
sys 0m0.000s
As you can see, the GNU version is about 5 times faster, but we'll still in the beta phase. Optimization will come later.
Name:
Anonymous2011-08-07 18:52
>>14
Actually it is infinite times faster, besides, you're not really testing the GNU echo implementation, you're testing the echo built-in of the GNU bash implementation (most likely).
Name:
152011-08-07 18:57
By the way, if you really want to test the GNU echo implementation invoke the shell with env echo Have you read your SICP today?
>>15 Actually it is infinite times faster, besides, you're not really testing the GNU echo implementation, you're testing the echo built-in of the GNU bash implementation (most likely).
The bash doc refers built-in command. The built-in's generally run faster than the external commands because the shell doesn't have to do an extra fork()/exec().
Oh god, you guys fucking suck.
This stupid shit reminds me of that time /g/ tried to write coreutils.
Name:
Anonymous2013-04-20 18:18
WAT DA FUCK IS DIS STUPID SHIT? WHO DA FUCK MAKES FUNCTIONS FOR THINGS DER R ALREADY OPERATORS FOR? FUCK DESE GUYS R A BUNCH OF STUPID STACK BOYS ARENT DEY?
Name:
Anonymous2013-04-20 18:19
AND SINCE WHEN IS ZERO POSITIVE? GET FUCKED. NEGATIVE IS < 0, POSITIVE IS > 0.
Name:
Anonymous2013-04-20 18:21
AND const-QUALIFIED IS DA STUPIDEST THING OF ALL, EVEN FUCKING STUPIDER THAN UR DIVIDE BY ZERO FUNCTION. USE A FUCKING MACRO OR A FUCKING ENUM, OR JUST USE THE FUCKING INTEGER CONSTANT U STUPID STACK BOYS.
I mean, jesus, you could at least use camelCase or underscores or something. Why aren't those functions inlined?
When would anyone even call isgreaterthan() anyway?
What's the point?
Name:
Anonymous2013-04-20 23:32
Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?
Mail me at jeremiahgoldstein@hotmail.com
25$ a pop
Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?
Mail me at jeremiahgoldstein@hotmail.com
25$ a pop
Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?
Mail me at jeremiahgoldstein@hotmail.com
25$ a pop
Name:
Anonymous2013-04-20 23:32
Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?
Mail me at jeremiahgoldstein@hotmail.com
25$ a pop
Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?
Mail me at jeremiahgoldstein@hotmail.com
25$ a pop
Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?