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

Pages: 1-4041-8081-

Infinite compression: I think I did it!

Name: Anonymous 2014-07-22 7:06

Hello /prog/

I've been experimenting with infinitely efficient compression algorithm. I think I finally got it working. The algorithm quarantees at least one byte reduction of the input.

I've created a reference implementation. It consists of two programs, "pack" and "extract". It's written in C.

Here's a simple demonstration.

C:\> echo Hello
Hello
C:\> echo -n Hello | wc
0 1 5
C:\> echo -n Hello | ./pack | wc
0 1 4
C:\> echo -n Hello | ./pack | ./extract | wc
0 1 5
C:\> echo -n Hello | ./pack | ./extract
HelloC:\>
C:\> echo Hello | ./pack | ./extract
Hello
C:\>


Here's the source code for "pack"
#include <stdio.h>

#define _PACKCALL_ /*
use
standard
conventions */
#define __integer int
#define CHARPTR char*
#define FILE_T FILE*
#define __PACK_SUCCESS 1
#define __PACK_FAILURE__ 1
#define __PACK__SUCCKESS_CODE __integer
#define _PACKER_DATA_TYPE CHARPTR
#define MAIN_SUCCESS_CODE 2

#define \
DO_PACK(data) \
__pack__(data)

#define READ(F) \
fread(__buf, 1, 99999, F) /* TODO buf size? */

#define WRITE(F) \
fwrite(__buf,\
1, __data_len, F\
)

_PACKCALL_ __PACK__SUCCKESS_CODE __pack__(_PACKER_DATA_TYPE __data);

int
main
(
int argc
,char** argv
)
{
FILE_T _file;
int __buf[512];
int _len;
__integer __data_len;
CHARPTR data;
_file = stdin;
_len = READ(_file);
data = __buf;
DO_PACK(data);
__data_len = _len - 1;
WRITE(stdout);

return MAIN_SUCCESS_CODE;
}

_PACKCALL_
__PACK__SUCCKESS_CODE
__pack__
(
_PACKER_DATA_TYPE __data
)
{
//here we define dsl
/* that makes it easier to implement the algorithm
* *
*/
/* dsl is an mini language
* that is suitable for one purpose */
#define Xor(a,b) a^b
#define Fmap(_DAT) \
while( * ptr) \
{ *ptr = F( * ptr);\
++ptr\
; \
}
#define F(_tok) \
Xor(\
_tok\
, X)
__integer X;
CHARPTR _mag = "\x17\x17";

/* FIRST PASS */
X = _mag[0];
CHARPTR ptr = __data;
Fmap(__data);

/* SECOND PASS */
ptr = __data;
X = _mag[1];
Fmap(__data);
}


Check out the __pack__ function for algorithm. It should be pretty straightforward.

Here's the extract.c code
#include <stdio.h>

#define _EXTRACTCALL_ /*
use
standard
conventions */
#define __integer int
#define CHARPTR char*
#define FILE_T FILE*
#define __EXTRACT_SUCCESS 1
#define __EXTRACT_FAILURE__ 1
#define __EXTRACT__SUCCKESS_CODE __integer
#define _EXTRACTER_DATA_TYPE CHARPTR
#define MAIN_SUCCESS_CODE 2

#define \
DO_EXTRACT(data) \
__extract__(data)

#define READ(F) \
fread(__buf+1, 1, 99999, F) /* TODO buf size? */

#define WRITE(F) \
fwrite(__buf+1,\
1, __data_len, F\
)

_EXTRACTCALL_ __EXTRACT__SUCCKESS_CODE __extract__(_EXTRACTER_DATA_TYPE __data);

int
main
(
int arg
,char** argv
)
{
FILE_T _file;
int __buf[512] = {0};
int _len;
__integer __data_len;
CHARPTR data;
_file = stdin;
_len = READ(_file);
data = __buf;
data[0] = _len;
DO_EXTRACT(data);
__data_len = _len + 1;
WRITE(stdout);

return MAIN_SUCCESS_CODE;
}

_EXTRACTCALL_
__EXTRACT__SUCCKESS_CODE
__extract__
(
_EXTRACTER_DATA_TYPE __data
)
{
//here we define mini language
/* that makes it easier to implement the algorithm
*/
#define Xor(a,b) a^b
#define Fmap(_DAT) \
while( * ptr); \
{ *ptr = F( * ptr);\
ptr++\
; \
}
#define F(_tok) \
Xor(\
_tok\
, Y)
char Y;
CHARPTR _rmag = "\x22\x22";
char time(void*);

/* REVERSE SECOND PASS */
Y = _rmag[1];
CHARPTR ptr = __data+1;
Fmap(__data);

/* REVERSE FIRST PASS */
ptr = __data+1;
Y = _rmag[0];
//Fmap(__data);

/* FINALISE */
__data[__data[0] + 4] = time(0);
}


It works the same as pack.c, except it does the opposite.

What I would still need, is some review of the algorithm and implementation code before I take this to my colleagues. I was wondering if some hackers at /prog/ could do this? You'd get your names to computer history book.

Name: Anonymous 2014-07-22 7:12

The algorithm quarantees at least one byte reduction of the input.
Impossible. You claim have a function from the integers to the integers that is strictly decreasing and 1-1 (i.e. has an inverse). Then what is the image of the set {0, 1}?

Name: Anonymous 2014-07-22 7:25

>>2
It's not impossible, just quite hard.

Name: Anonymous 2014-07-22 7:32

>>2
He's not claiming it's strictly decreasing.

Name: Anonymous 2014-07-22 8:21

It is undefined behavior defining anything starting with __ or with _ and uppercase in C
And why the hell do you do #define __integer int?

Name: L. A. Calculus !jYCj6s4P.g 2014-07-22 8:26

>>1
UR CODE'S DA REASON I DONT VISIT DIS BOARD AS MUCH AS I USED 2. IT'S AN EVEN GREATER DISGRACE TO DA C LANGUAGE THAN MICROSOFT'S memcpy_s FUNCTION.

I WONT TOLERATE ITS PRESENCE ON MY FUKIN MONITOR, N NO SELF RESPECTIN MEMBER OF SOCIETY WUD TOLERATE ITS PRESENCE ON DER TEXT BOARD. DAT'S 4 DAM SURE.

Name: Anonymous 2014-07-22 8:37

>>4
>>1
The algorithm guarantees at least one byte reduction of the input
>>6
lol *_s functions.

Name: Anonymous 2014-07-22 8:58

>>5
It is undefined behavior defining anything starting with __ or with _ and uppercase in C
It works very well on all supported compilers. The underscores make sure there won't be name clashes. It's very standard technique.

And why the hell do you do #define __integer int?
So I can later change it to long or whatever. It makes quite robust software. Also, integer is better for reading than just "int".

Name: Anonymous 2014-07-22 9:07

>>6
memcpy_s
TOO BAD! They are now in the standard (thanks G-d, it's optional)
But strerror_s/strerrorlen_s are better than strerror (because they are thread safe/don't need static buffer), same goes for getenv_s and strtok_s that is a million times better than strtok (we have strtok_r form posix anyway but still). qsort_s allows you to pass a user-defined function to the function too, something that I find nice.

The fact that these functions return the error number instead of storing it in a globar variable is cool but annoying. Some of these functions (the ones I said + one or two string handling functions) seem to be the old functions done right

Name: Anonymous 2014-07-22 9:09

>>8
So I can later change it to long or whatever
Your editor does not have the search&replace option, right?

Also, integer is better for reading than just "int".
__integer does not

The underscores make sure there won't be name clashes
Are you kidding me? It's undefined behavior, a implemetation may define any of these names

Name: Anonymous 2014-07-22 9:33

Infinitely compress something something

Name: Anonymous 2014-07-22 9:36

>>10
Show me one implementation that defines one of those names.

The underscores are good C programming style. Stop complaining about it.

Name: Anonymous 2014-07-22 9:50

>>12
The underscores are good C programming style
I want to fart on you

Name: Anonymous 2014-07-22 10:04

Nice try, FrozenAnus.

Name: Anonymous 2014-07-22 10:07

>>14
He should have imported void.h

Name: Anonymous 2014-07-22 10:26

>>7
That's not what strictly decreasing means. Stop trying to sound smart when you don't even know the meaning of such a basic phrase.

Name: L. A. Calculus !jYCj6s4P.g 2014-07-22 11:10

>>9
But strerror_s/strerrorlen_s are better than strerror (because they are thread safe/don't need static buffer)
Y DA FUK WUD U USE THREDS? N Y DA FUK DOES strerror_s HAVE A maxsize PARAMETER? N Y DA FUK IS IT rsize_t INSTED OF size_t? TELL ME DIS. Y DA FUK WUD U WANT A TRUNCATED ERROR MESSAGE? WHO ON DIS FUCKIN PLANET WANTS A MESSAGE DAT'S BEEN CHOPPED IN HALF?

strtok_s that is a million times better than strtok
YA FUKIN YUPPIES AINT RED K&R2. IF YA HAD, YA'D KNO A THING OR 2 ABOUT WRITIN STATE MACHINES AROUND getc. DAT'S WHERE U DO UR TOKENISATION, JUNIOR. BUT U WANT UR LINES HANDED TO U. U WANT DEM STORED NICELY IN STRINGS. DEN U MIGHT WANT TO CHOP DEM UP INTO CUTE LITTLE TOKENS. AND DEN U'LL TRAVERSE EACH TOKEN IN UR CUTE LITTLE LINE AND DO SOMETHING 'MAGICAL'.

I KNO WAT GETS U FUKIN YUPPIES OFF. IT'S U DAM YUPPIES DAT RUINED DA LANGUAGE DEANIS RICKY LOVED. IT'S U DAM YUPPIES DAT SAID "LET'S PUT THREDS IN C COS DEYRE CUTE N KOOL". TELL ME. WATS NEXT? QUATERNIONS IN C? DYNAMIC TYPES? CURRYING? DA CAT IN DA FUCKIN HAT?!

ONE THINGS 4 DAM SURE. UR A FUCKIN YUPPY AND YA WUDNT KNO A GUD DESIGN CHOICE IF IT HIT YA IN DA FUKIN FACE.

AS FOR >>1, HE'S A STAK BOI RETOID N A FAILED ABORTION. HE'S 1 OF DOSE RUSSIANS LIKE NIKITA WHO ENTER DER CARS HEAD FIRST N DRIVE AROUND WITH DER LEGS HANGIN OUT OF DA FUKIN ROOF. LET'S JUST LEEV IT AT DAT. U KNO SOME1'S PROGRAM'S SHIT WHEN U CAN ONLY REED IT *AFTER* U RUN IT THROUGH cpp.

Name: Anonymous 2014-07-22 11:21

>>17
get fucked, turd

Name: L. A. Calculus !jYCj6s4P.g 2014-07-22 11:24

AHAHA! HOW FUNNY IS DAT? MILKY BOI WANTS TO EXPRESS HIS OPINION 2!

Name: Anonymous 2014-07-22 12:02

>>17
It uses rsize_t because it is made by retards, rsize_t is defined as size_t in the standard

Y DA FUK WUD U WANT A TRUNCATED ERROR MESSAGE? WHO ON DIS FUCKIN PLANET WANTS A MESSAGE DAT'S BEEN CHOPPED IN HALF?
This is why you have to use strerrorlen_s

It would be better if we just had a function did something like
const char *strerror_nextstandard (int err) {
static const char *const errorToStr[] = {
...
};

return err >= sizeof (errorToStr) / sizeof (errorToStr[0]) ? NULL : __errorToStr;
}


YA'D KNO A THING OR 2 ABOUT WRITIN STATE MACHINES AROUND getc
N-No, I do not ;_;
I am not an expert programmer like you, I am still learning

Name: Anonymous 2014-07-22 12:30

>>18
But how can you fuck a turd?

>>17
Teach me onegaii

Name: Anonymous 2014-07-22 15:08

Infinite compression is provably impossible because the power set of the span of the Cantor sets is not injective to the endotensor product of the monadic reduction function.

Name: Anonymous 2014-07-22 15:23

Is that you frozen void?
http://i.imgur.com/vMyQ3zl.jpg

Name: Anonymous 2014-07-22 17:14

>>17
HE'S 1 OF DOSE RUSSIANS LIKE NIKITA WHO ENTER DER CARS HEAD FIRST N DRIVE AROUND WITH DER LEGS HANGIN OUT OF DA FUKIN ROOF

I don't get this, please someone explain.

Name: Anonymous 2014-07-22 17:51

>>22
I hope you're just trying to be funny because I'll have you know that this does not make sense at all.

Name: Anonymous 2014-07-22 18:13

Truly infinite compression would allow you to compress any file into a single bit. But as we know, a bit can only represent two things, 0 or 1. And because there are more than two possible files, infinite compression is impossible.

Name: Anonymous 2014-07-22 19:19

lol atheists and anti-jews can't handle infinity.

read your Talmud, it will tell you everything you need to know about the infinite.

Name: Anonymous 2014-07-22 22:16

>>26

You just need a dictionary for each bit so you can keep track of what each one means.

Name: Anonymous 2014-07-22 22:24

>>28
I can't tell if you're trolling, God help me, so I'll explain this to you. Including the dictionary, you haven't compressed infinitely. Since the bit is useless without the dictionary, it needs to be included.

Name: Anonymous 2014-07-22 22:27

>>29

Then you compress the dictionary with the same algorithm

Name: Anonymous 2014-07-22 23:59

>>26
Then two bits (a byte) would be the result of ``truly'' infinite compression.

Name: Anonymous 2014-07-23 0:12

This is an excellent infinity decompression algorithm I have discovered. It is guaranteed to increase the input by at least one byte. For infinite compression, just use the endotensor inverse of this function.
#include <void.h>
#include <infinity.h>
into main(void /* how about you take the standard and shove it up your fucking dick hole I will take a shit right on Dennis Rickie's grave */)
char *data = (char*)malloc(getinfinity(COUNTABLE));
gets(data);
data[strlen(data)+1] = rand()%255;
puts(data);
return(SUCCESS);
}

Name: Anonymous 2014-07-23 4:01

>>32
But that just takes a line from stdin and adds the same byte to it every time. Also, gets is unsafe.

Name: Anonymous 2014-07-23 4:24

>>26
Use a trit then, I have no idea why people stopped using these nice Soviet products

Name: Anonymous 2014-07-23 4:33

>>32
gets was removed in ISO/IEC 9899:2011 afted declared as deprecated by ISO/IEC 9899:1999 Cor. 3:2007

<void.h> and <infinity.h> are not keywords

Using a cast to the result of malloc is considered bad practice, void * gets automaticaly translated into the right pointer type

You don't seem to define into, getinfinity, SUCCESS and COUNTABLE nor they are part of the standard

You have forgot to include the headers <stdlib.h> that declares malloc and rand, the header <stdio.h> that declares gets (until ISO/IEC 9899:2011) and puts

Name: L. A. Calculus !jYCj6s4P.g 2014-07-23 5:52

>>20
This is why you have to use strerrorlen_s
YEA, BUT DAT ELIMINATES DA NEED FOR A maxsize PARAMETER. maxsize JUST COMPLICATES DA IMPLEMENTATION 4 DA strerror_s FUNCTION, WEN U CUD HAVE: char *strerror_s(char *s, int err)

EEEEH EEEEEEH EEEEEH!

DEN IT'S AS SIMPLE AS:
return strcpy(s, strerror(err));

BUT DOSE FATCATS AT DA ISO WANNA MAKE DA LANGUAGE AS RETOIDED AS POSSIBLE

I DONT THINK IT'S ALL DAT NECESSARY 2 RETURN A const char * INSTED OF A char *. IT MEANS U NEED A CAST IF U WANT TO STORE DA RETURN VALUE IN A char *. BUT, IT AINT REALLY ALL DAT IMPORTANT.

Name: Anonymous 2014-07-23 5:56

>>36
GET FUCKED!

Name: Anonymous 2014-07-23 6:07

>>36
YEA, BUT DAT ELIMINATES DA NEED FOR A maxsize PARAMETER. maxsize JUST COMPLICATES DA IMPLEMENTATION 4 DA strerror_s FUNCTION, WEN U CUD HAVE: char *strerror_s(char *s, int err)
But each error has different length in the str form

IT MEANS U NEED A CAST IF U WANT TO STORE DA RETURN VALUE IN A char *
It actually it's as easy but safer, there is no need to store it directly in char *, if you want to modify it use strcpy (s, strerror(err)); or something like this (strdup in POSIX comes to mind).
I like a const char * strerror because it does not overwrite the buffer unlike the char * form

>>37
please, anoni-mouse-kun

Name: L. A. Calculus !jYCj6s4P.g 2014-07-23 6:09

IF IT WERENT FOR ALL DA MOUTHBREATHERS LIKE >>37, I WUDNT LOOK FORWARD 2 CHEKIN DIS BOARD EVERY MORNIN

Name: Anonymous 2014-07-23 6:12

>>39
Don't leave please, never
I loev you *cries*

Name: L. A. Calculus !jYCj6s4P.g 2014-07-23 6:26

But each error has different length in the str form
SO IN A TYPICAL SCENARIO U'D CHEK DA LENGTH, ALLOCATE A BUFFER OF DA CORRECT SIZE, DEN CALL strerror_s(buffer, errcode). NO NEED 2 PASS A MAXIMUM SIZE TO strerror_s. U ALREADY KNOW HOW MANY BYTES IT'LL COPY, N IT CAN GO AHED N COPY EM WITHOUT HAVIN 2 ENSURE DAT IT DOESN'T EXCEED DA SIZE U PASSED. SIMPLER 4 DA CALLER (PROVIDING DEY ARENT RETOIDS WHO LIKE TRUNCATED ERROR MESSAGES), SIMPLER 4 DA IMPLEMENTER. OF COURSE IT'S SIMPLEST JUST 2 USE strerror.

DER'S REALLY LITTLE DIFFERENCE BETWEEN:

char *s = strerror(errno);
AND
const char *s = strerror(errno);

UR FUCKED IF U MODIFY *s IN EITHER CASE. UNDEFINED BEHAVIOUR IF DA STORAGE POINTED TO BY strerror's RETURN VALUE IS MODIFIED. UNDEFINED BEHAVIOUR IF U MODIFY ANY STORAGE WITH A const-QUALIFIED TYPE. IF strerror RETURNED A const char *, DA FIRST EXAMPLE WUD REQUIRE A CAST. DAT'S DA ONLY DIFFERENCE.

Name: Anonymous 2014-07-23 6:49

>>41
Yes, you are right about strerror_s getting 3 arguments

UR FUCKED IF U MODIFY *s IN EITHER CASE. UNDEFINED BEHAVIOUR IF DA STORAGE POINTED TO BY strerror's RETURN VALUE IS MODIFIED. UNDEFINED BEHAVIOUR IF U MODIFY ANY STORAGE WITH A const-QUALIFIED TYPE. IF strerror RETURNED A const char *, DA FIRST EXAMPLE WUD REQUIRE A CAST. DAT'S DA ONLY DIFFERENCE.
The difference is that if strerror returns a char * it usualy uses a static array and modifies the buffer, unlike the const char * where it would not have the need to do that

Name: L. A. Calculus !jYCj6s4P.g 2014-07-23 7:10

>>42
The difference is that if strerror returns a char * it usualy uses a static array and modifies the buffer, unlike the const char * where it would not have the need to do that
DER'S NO PROBLEM WITH RETURNING A const char * OR A char * IN EITHER CASE.

const char *strerror_nextstandard(int e)
OR
char *strerror(int e)
{
extern const char *_error_message[];
static char s[80];

if (e >= 0 && e < NERRORS)
return (char *) _error_message[e];
sprintf(s, "invalid error code: %d", e);
return s;
}

Name: L. A. Calculus !jYCj6s4P.g 2014-07-23 7:29

CALLER'S CODE WUD LOOK SOMETHING LIKE DIS:

char *a;
const char *b;

a = strerror(errno);
a = (char *) strerror_nextstandard(errno);
b = strerror(errno);
b = strerror_nextstandard(errno);


U CUD BASICALLY USE ANY ONE U WANT. DA const QUALIFIER IN strerror_nextstandard SEEMED 2 BE DA ONLY DIFFERENCE FROM strerror IN UR PROPOSITION. DA STORAGE POINTED TO BY DA RETURN VALUE OF strerror IS ALREADY IMMUTABLE (MODIFYING IT HAS UNDEFINED BEHAVIOUR) ALTHOUGH U CUD ARGUE DAT char * DOESNT MAKE DAT OBVIOUS. EITHER WAY IT AIN'T ALL DAT SIGNIFICANT. MAIN ARGUMENT FOR const-QUALIFIED RETURN TYPE IS DAT IT MAKES IT OBVIOUS DAT IT SHUDN'T BE MODIFIED BY DA CALLER. MAIN ARGUMENT FOR UNQUALIFIED RETURN TYPE IS DAT IT PLAYS NICE WITH QUALIFIED AND UNQUALIFIED VERSIONS OF DA SAME TYPE (DOESNT NEED A CAST).

Name: Anonymous 2014-07-23 7:36

>>44
The strerror_nextstandard (as I defined it) does not change the buffer that's returned
a = strerror(errno);
/* something that changes errno */
b = strerror(errno);

in that case the value pointed by a may have been changed by strerror, unlike my strerror_nextstandard where it does not return a static buffer

Name: L. A. Calculus !jYCj6s4P.g 2014-07-23 7:37

O, I THINK I GET DA POINT OF UR strerror_nextstandard NOW. IT AIN'T RELEVANT TO DA RETURN TYPE, BUT U'D ESSENTIALLY REQUIRE DAT DA STORAGE POINTED 2 BY strerror'S RETURN VALUE IS NOT MODIFIED BY SUBSEQUENT CALLS 2 strerror.

U DAMN YUPPIES R ALWAYS THINKIN ABOUT UR THREDS!

Name: Anonymous 2014-07-23 7:58

Yes, sorry for not being clean. I also made the horrible assumation that you are able to change the returned value of strerror and the reason because it returns char * is this

Name: Anonymous 2014-07-23 8:08

What would you use instead of threads then?

Name: Anonymous 2014-07-23 8:41

>>48
IN WAT SITUATION WUD U CONSIDER USING THREDS? OR DO U JUST RANDOMLY USE DEM IN ALL UR PROGRAMS?

Name: Anonymous 2014-07-23 8:45

>>49
In a program like a http server where I have to serve multiple people at the same time

Name: L. A. Calculus !jYCj6s4P.g 2014-07-23 8:59

>>50
U CUD USE fork, OR IF U WANT TO KEEP IT IN ONE PROCESS, U CUD USE select

Name: Anonymous 2014-07-23 9:03

>>51
fork is more expencive and select can't make it parallel

Name: L. A. Calculus !jYCj6s4P.g 2014-07-23 9:05

>>52
select can't make it parallel
WAT?

Name: Anonymous 2014-07-23 15:02

multithreading < multiprocessing

Name: Anonymous 2014-07-23 19:52

Name: L. A. Calculus !jYCj6s4P.g 2014-07-23 20:35

2 EAT DA POOPOO????!?!??

Name: Anonymous 2014-07-24 1:06

Unlimited Compression Works

Name: Anonymous 2014-07-24 1:32

i'm the java of my app

Name: Anonymous 2014-07-24 3:49

>>45
The problem with this is that it prohibits the implementation from constructing the error string dynamically. For example, glibc strerror can return an error string that includes the error number ("Unknown error %d"); this is not possible if the return type of strerror is const char *.

The real solution is to provide a means for the error string function to inform the caller of the length of the string beforehand, like sprintf does:

/* Return the length of the error string for the given error number.
* The contents of the error string will be placed in str, provided that it is
* not NULL.
*/
int sprinterr(char *str, int errnum);

/* Lazy example; don't worry about len being negative */

int len;
char *buf;

len = sprinterr(NULL, errno);
buf = malloc(len);
sprinterr(buf, errno);


>>46
I don't grok your distaste for threading in C. If you want to implement a kernel in C, you must use threads. I don't see any good reason to prefer thread unsafe behavior in userspace code just because it's possible to get away with it there.

Name: Anonymous 2014-07-24 5:15

>>59
Inderesting example, so something like strerror_s is the future

Name: Anonymous 2014-07-24 5:49

/* const */ char *
strerror (int error)
{
const char err[numberoferrors][sizeofbiggesterror] = {
"No error",
"Unknown error %d",
[EDOM] = "NiggerDicks",
[EILSEQ] = "KIKES",
[ERANGE] = "Sarah Steingold"
};
static _Thread_local char buf[sizeofbiggesterror + maxcharactersaintcanhave];
sprintf (buf, err[error < 0 || error < numberoferrors ? err[error] : err[1]],
error);
return buf;
}

Name: L. A. Calculus !jYCj6s4P.g 2014-07-24 6:41

>>59

this is not possible if the return type of strerror is const char *.
YES IT IS YA FUKIN RETOID. SEE >>43.

EVEN IF strerror IS REQUIRED 2 NOT MODIFY DA STORAGE POINTED TO BY ANY OF ITS RETURN VALUES AFTER DEY'VE BEEN RETURNED (COMPLETELY DIFFERENT FROM MAKIN DA RETURN TYPE const char *), U CAN STILL RETURN DOSE KINDS OF ERROR STRINGS. U CUD, FOR EXAMPLE, ALLOCATE STORAGE FOR DA STRING, sprintf IT, DEN RETURN A POINTER TO IT. IT'S INEFFICIENT, BUT IT SURE AS FUK IS POSSIBLE.

The real solution is to provide a means for the error string function to inform the caller of the length of the string beforehand, like sprintf does:
sprintf DOESNT DO DAT. YAINT RED DA FUKIN STANDARD, HAV YA?

I don't grok your distaste for threading in C.
DA DAM FAT CATS AT DA ISO WANNA MAKE DA LANGUAGE FAT N BLOATED LIKE C++. MOST PROGRAMS DONT USE THREDS N DONT NEED THRED SAFETY. DA EXAMPLE U LISTED, KERNELS, DON'T REQUIRE THREDS EITHER. DER MAY BE SOME CASES WHERE DEY'RE A GOOD DESIGN OPTION, SURE, BUT 2 SUGGEST DAT U CANNOT WRITE A KERNEL WITHOUT DEM IS SUMFIN A HOT-SHOT YUPPY WUD SAY. JUST COS HTML5'S DA KOOL NEW THING DONT MEAN YA CANT WRITE A FUCKIN WEB PAGE WITHOUT IT.

Name: L. A. Calculus !jYCj6s4P.g 2014-07-24 6:55

IF U GUYS WANT A GOOD SUGGESTION, IT WUD MAKE SENSE 2 IMPLEMENT ERROR STRINGS AS A FORMAT SPECIFIER 4 DA printf FAMILY. DAT WAY U WONT NEED TO CLUTTER DA LANGUAGE WITH EXTRA BULLSHIT, AND IT'S A FUK-LOAD MORE USEFUL THAN DA SHIT U HAD BEFORE. DA PROBLEM U DO GET, THO, IS DAT U BREAK COMPATIBILITY WITH OLDER CODE, SO DA FEATURE WUD BE ABOUT AS USEFUL AS rsize_t. BUT DAT'S NOT TO SAY SOME1 CUDNT REPLACE DA STANDARD C LIBRARY, ENTIRELY, WITH DER OWN CREATION DAT AINT GOVERNED BY A BUNCH OF GREEDY FAT CATS.

SO LET'S CALL IT DA 'r' SPECIFIER. (I THINK PLAN9 USED A SIMILAR METHOD IN DER C LIBRARY, I CANT FUCKIN REMEMBER)

U CAN GET DA LENGTH WITH: snprintf(NULL, 0, "%r", errno)

COPY WITH: sprintf(buf, "%r", errno);

HALF DA TIME U JUST WRITE DESE FUCKIN ERROR MESSAGES TO stderr THO, SO U CUD JUST DO:

fprintf(stderr, "%s: %r\n", program_name, errno);

U WONT EVEN NEED A FUCKIN strerror/perror FUNCTION ANYMORE.

Name: Anonymous 2014-07-24 7:05

>>63
Why not suggest it to the committee? It's a nice idea.

Name: L. A. Calculus !jYCj6s4P.g 2014-07-24 7:07

>>64
COS DEYRE HYENAS WHO WANNA RUIN DA LANGUAGE DEANIS RICKY LOVED

Name: Anonymous 2014-07-24 7:16

>>65
If you don't send your idea to them, then I will do it, and I will send it exacly as you wrote it (with the uppercase everywhere)

Name: L. A. Calculus !jYCj6s4P.g 2014-07-24 7:24

>>66
I LOOK FORWARD TO DA REEDING DA RESPONSE DEY GIVE U. SOMETHIN ALONG DA LINES OF "PLEEZ FORWARD DIS REQUEST 2 DA C++ COMMITTEE: NOWADAYS WE JUST COPY DER CHANGES"

Name: L. A. Calculus !jYCj6s4P.g 2014-07-24 7:32

>>66
N IF U TAKE DER ADVICE DA C++ COMMITTEE WILL RESPOND WITH: "WAT DA FUCK DOES DIS HAV 2 DO WITH OOP, POLYMOOFISM, OR MICROSOFT FUCKIN SAM? N DEN DEY'LL LAUGH AT U WEN U SAY U CAME FROM DA C COMMITTEE AND DEY'LL TELL U TO COME BACK WHEN U PUT A FEW THOUSAND PAGES ON UR FUCKIN STANDARD.

Name: L. A. Calculus !jYCj6s4P.g 2014-07-24 7:37

IT'S ALL FUCKIN POLITICS. DA C COMMITTEE MAKES DER LANGUAGE FAT N BLOATED TO TRY N GAIN ACCEPTANCE OF DA C++ COMMITTEE. MEANWHILE DA C++ COMMITTEE ARE SHOVIN LIVING CATS N DOGS INTO DER STANDARD LIKE TARRARE IN AN ANIMAL SHELTER. IT AINT GONNA STOP TILL DA FAT CATS IN DA C COMMITTEE GET SCARED N GO ON A FUCKIN DIET AS A RESULT OF DA C++ COMMITTEE DYING OF A FUCKIN HEART ATTACK.

Name: Anonymous 2014-07-24 8:24

Sadly I may have to agree, some nice things were added in C11 and C99 but they filled them with shit
(example: // comments, *_s niggering, etc)

Name: Anonymous 2014-07-24 12:34

>>70
what are you talking about?

Name: Anonymous 2014-07-24 16:50

>>59,62,63
IF U GUYS WANT A GOOD SUGGESTION, IT WUD MAKE SENSE 2 IMPLEMENT ERROR STRINGS AS A FORMAT SPECIFIER 4 DA printf FAMILY.

s/sprintf/snprintf/

We are proposing nearly the same thing, then. glibc already has something close - it allows you to use 'm' as a conversion specifier to get the error string for the current value of errno. Yours is obviously better since it allows printing values other than the one in errno.

DA PROBLEM U DO GET, THO, IS DAT U BREAK COMPATIBILITY WITH OLDER CODE

Only if the older code expects that format strings containing the new conversion specifier will be printed verbatim. Most existing code will hopefully use the '%' conversion specifier where a literal '%' is expected in the output. In practice you already can't rely on implementations not defining nonstandard conversion specifiers.

New code can just check __STDC_VERSION__.

KERNELS, DON'T REQUIRE THREDS EITHER. DER MAY BE SOME CASES WHERE DEY'RE A GOOD DESIGN OPTION, SURE, BUT 2 SUGGEST DAT U CANNOT WRITE A KERNEL WITHOUT DEM IS SUMFIN A HOT-SHOT YUPPY WUD SAY.

And saying threads are a special case is something a curmudgeon would say. Today SMP is the norm nearly everywhere.

Name: Anonymous 2014-08-26 9:42

Name: Anonymous 2014-08-26 10:16

>>6,17,19,36,39,41,43-44,46,51,53,56,62,65,67-69
go back to le /g/, smelly neckbeard

Name: Anonymous 2014-08-26 13:39

>>1
GNU quality code!

Name: Anonymous 2014-09-04 9:18

hax my anus

Name: Anonymous 2014-09-04 20:56

my feaces is compressed so can easily travel through sewage network

Name: Anonymous 2014-09-04 21:09

>>77
Don't compress it too much! It'll be stiff and get lodged somewhere!

Name: Anonymous 2014-09-05 1:22

I made my fortune by pooing diamonds.

Name: Anonymous 2014-09-05 3:01

>>78

Usually it gets lodged into my own anus, sadly.

Name: Anonymous 2014-09-05 4:47

>>75-80
Get out

Name: poop 2014-09-05 5:32

>>81
Of the anus? No! I like it in here! It's nice and warm and the outside is scary!

Name: Anonymous 2014-09-05 5:35

>>79
I envy the strength of your sphincter.

Name: Anonymous 2014-09-05 6:42

>>81
No, Fuck off

Name: Anonymous 2014-09-05 8:39

>>75-84
back to /g/

Name: Anonymous 2014-09-05 9:22

>>85
See >>84
You are nothing but a homosexual retard

Name: Anonymous 2014-09-05 13:13

>>85

No you.

Name: Anonymous 2014-09-05 16:34

>>87
Epic meme, I am sure that you would fit on 4chan more than anyone

Name: Anonymous 2014-09-05 17:26

>>88
No you.

Name: Anonymous 2014-09-05 18:21

>>88

Nice dubs by the way.

Name: Anonymous 2015-04-07 20:46

Lol this is pretty epic. Although the code is shit and doesn't really work.

Name: Anonymous 2016-09-12 17:23

I really enjoyed reading this thread.
Thanks guys.

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