LoseThos does not have streams, more or less. It's supposed to be for recreational programming. Streams and pipes are more often for admins. In the actual act of programming and debugging, do you find you use them? For video games, you don't. For more adult things, you use printf() and cmd line, but pipes? LoseThos has printf.
asm is a mark of IQ
interrupts are a mark of IQ
pipes are a mark of IQ
pipes and regexs are a mark of IQ
spelling and grammar is a mark of IQ
wit is not a mark of IQ -- wisdom.
They are pretty-much IQ by common concensus.
Name:
Anonymous2011-09-26 3:58
wisdom is not IQ
Name:
Anonymous2011-09-26 4:25
Chen
Name:
Anonymous2011-09-26 4:26
I opened the window and the sun came in, my cat sits on the table soaking up the sun
Here's Anonix cat: /* @cat.c */
/* NOTE: GNU's cat will not cat a file into itself. Should we check for this?
Possibility of infinite loop here. POSIX doesn't specify what happens if
standard input happens to be standard output (cat to temp. file and then
write that to the output? don't write what was already written?) */
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#define CATBUF_SIZE 65536 /* increase this if you want OMG MOAR SPEED! */
char catbuf[CATBUF_SIZE];
int main(int argc, char** argv) {
int uflag = 0, retval = 0, i = 1, c;
FILE *input;
>>13
In fact i do. I'm now in the greener pastures of dynamic languages
Name:
FrozenVoid2011-09-26 9:32
>>13
I tend to check asm output for each change to get the feel of what treachery each compiler tries to do. I don't program in asm, but i have the tables/opcode latencies and their args/call/regs and i can handle checking small functions very closely for optimization.
Name:
Anonymous2011-09-26 9:55
>one-width indentations
>space indentations
>lack of spaces in syntax
>having options in cat (this is POSIX invalid)
>putting the asterisks next to the base type
>taking more than ~10 lines for cat PIG DISGUSTING
mercury tmp # time dd if=/dev/zero bs=4096 count=1048576 | cat > /dev/null
1048576+0 records in
1048576+0 records out
4294967296 bytes (4.3 GB) copied, 1.77577 s, 2.4 GB/s
real 0m1.776s
user 0m0.218s
sys 0m1.576s
mercury tmp # time dd if=/dev/zero bs=4096 count=1048576 | ./a.out > /dev/null
1048576+0 records in
1048576+0 records out
4294967296 bytes (4.3 GB) copied, 59.5882 s, 72.1 MB/s
real 0m59.590s
user 0m57.176s
sys 0m2.389s
I do wonder why GNU cat is so much faster than my cat.
Guideline 10:
The argument -- should be accepted as a delimiter indicating the end of options. Any following arguments should be treated as operands, even if they begin with the '-' character. The -- argument should not be used as an option or as an operand.
--
And if you're wondering "what if I have a file named '--'", that would be cat -- --.
>>17-22
These are going to be slow as fuck because they're all reading and writing one char at a time.
Name:
Anonymous2011-09-26 10:28
>>28
Oh, so that's why it can only do 72.1 MB/s. >>26
>>29
Time the Anonix version >>8. I bet it'll be at least twice as fast, if not more. GNU cat is doing some weird voodoo.
Name:
Anonymous2011-09-26 10:31
>>30 mercury tmp # cc -xc -Wall -Werror -Wextra -ansi -pedantic -
[code goes here lol]
cc1: warnings being treated as errors
<stdin>: In function 'main':
<stdin>:19:2: error: implicit declaration of function 'getopt'
<stdin>:27:5: error: 'optind' undeclared (first use in this function)
<stdin>:27:5: note: each undeclared identifier is reported only once for each function it appears in
<stdin>:48:3: error: suggest parentheses around assignment used as truth value
<stdin>:49:32: error: comparison between signed and unsigned integer expressions
$ cc cat.c
$ time dd if=/dev/zero bs=4096 count=1048576 | cat > /dev/null
1048576+0 records in
1048576+0 records out
4294967296 bytes (4.3 GB) copied, 1.65333 s, 2.6 GB/s
real 0m1.670s
user 0m0.196s
sys 0m3.096s
$ time dd if=/dev/zero bs=4096 count=1048576 | ./a.out > /dev/null
1048576+0 records in
1048576+0 records out
4294967296 bytes (4.3 GB) copied, 2.23426 s, 1.9 GB/s
real 0m2.237s
user 0m0.240s
sys 0m4.080s
$
Name:
Anonymous2011-09-26 10:52
>>32
That's because you're not using -Wall -Werror -Wextra -ansi -pedantic which is the minimum required to ensure good code.
>>36
I wonder if cat could benefit from multi-threading.
Name:
FrozenVoid2011-09-26 11:50
>>37
Adding complexity is not justified just because you want that 5% speedup. You have to think about what you need to multithread, unlike some people who make 10 threads which eat up cpu time doing 1 threads work and decreasing OS performance.
>>37
You don't need that shit, it either works or doesn't. Those error messages broken down: <stdin>:19:2: error: implicit declaration of function 'getopt'
Your system is not POSIX. getopt is in unistd.h.
(http://pubs.opengroup.org/onlinepubs/000095399/functions/getopt.html) <stdin>:27:5: error: 'optind' undeclared (first use in this function)
Same thing. <stdin>:48:3: error: suggest parentheses around assignment used as truth value
Not an error. <stdin>:49:32: error: comparison between signed and unsigned integer expressions
Doesn't matter, it's only checking for equality between however many bytes read and written.
I should've stopped at the first error; compiling a POSIX utility on a non-POSIX system is already doing it wrong.
>>37
It's an inherently serial process. The only speedup possible is by reading/writing bigger chunks.
Name:
Anonymous2011-09-26 14:09
>>44 It's an inherently serial process. The only speedup possible is by reading/writing bigger chunks.
Nope.
You should learn to cast so you don't get such shitty errors.
If when you compile your code it spews out a bunch of warnings and errors you're a terrible person and you should feel bad.
>>47
Your an even more terrible person. Casting in such cases is only a way of asking the compiler to shut up; it doesn't magically makes the code correct.
Imagine if all you had was 1 byte of pointers. The amount of memory saved. Lower CPU usage. Safety. Green computing
Switch to TROLLGOL today to experience the benefits of 1-byte addressing. Enterprises can't go wrong with 60-year proven solution.
--TROLLGOL design commitee
Name:
Anonymous2011-09-26 15:40
>>56
No, we should divide memory space into segments. Each segment will have a 1 byte address, and then sub-segments will have their own addresses, and so on for sub-sub-segments. Then all addresses to bytes will be stores in a linked list of pointers. It's the future.
>>63
I'm not sure if it's -ansi or -pedantic, but one of them restricts GCC to only define standard C features, which basically undefines the macros GNU_SOURCE, POSIX_SOURCE, XOPEN_SOURCE, etc. etc. and therefore removes the availability of non-standard functions.