1
Name:
Anonymous
2021-03-09 11:00
Hey queers! Here is a proper replacement for printf called shit()
#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <stdarg.h> void hidden_shit(uint64_t a0, ...) { va_list ap; uint64_t type = a0; va_start(ap, a0); type = va_arg(ap, uint64_t); for (int i = 0; type; i++) { if (type > 32) { printf("%s", (char*)type); type = va_arg(ap, uint64_t); continue; } if (type == 1) { printf("%lld", va_arg(ap, uint64_t)); } else if (type == 2) { printf("%llx", va_arg(ap, uint64_t)); } else if (type == 3) { printf("%f", va_arg(ap, double)); } else if (type == 4) { printf("%p", (void*)va_arg(ap, uint64_t)); } type = va_arg(ap, uint64_t); } printf("\n"); va_end(ap); } #define shit(...) \ do { \ uint64_t S=1, X=2, F=3, P=4; \ hidden_shit((uint64_t)0,__VA_ARGS__,(uint64_t)0);\ } while(0) int main() { int a = 123, b = 456, c = 666; shit("hello world!"); shit("c=",S,c); shit(S,a,",",F,456.0,",",X,b,",done"); char *verb = "go fuck", *object = "yourself", *adjective = "dumbfuck"; shit(verb," ",object,", ",adjective); return 0; }
2
Name:
Anonymous
2021-03-09 11:09
why does a printf replacement use printf?
3
Name:
Anonymous
2021-03-09 11:45
>>2 Because unistd.h is not portable.
4
Name:
Anonymous
2021-03-10 19:30
Using NashC(tm)#include <nsh.h> #include <nsh/pp.h> char *int.cstr { int n = *this; int l = snprintf(NULL, 0, "%d", n); char *s = (char*)mAlloc(l+1); sprintf(s, "%d", n); return s; } char *float.cstr { float n = *this; int l = snprintf(NULL, 0, "%f", n); char *s = (char*)mAlloc(l+1); sprintf(s, "%f", n); return s; } char *double.cstr { float n = *this; int l = snprintf(NULL, 0, "%f", n); char *s = (char*)mAlloc(l+1); sprintf(s, "%f", n); return s; } char *char.cstr { return this; } void say_impl_(int count, ...); #if 0 #define say(...) \ do { \ say_impl_(PP_SIZE(__VA_ARGS__),__VA_ARGS__); \ } while(0) #else #define nsh_cstr(x) ((x).cstr) #define say(...) \ do { \ printf("%s\n", catd(" ",PP_SIZE(__VA_ARGS__),PP_MAP(nsh_cstr,__VA_ARGS__)); \ } while(0) #endif int main() { say("x =",123.456); return 0; }
Suddenly C becomes a bearable programming language. Just don't ask me how I do the GC.
5
Name:
Anonymous
2021-03-11 4:17
>>4 Can we see the nsh.h file?
8
Name:
Anonymous
2021-03-11 15:13
>>7 Ok. Now it is nc.h and has the following content
//NashC language main header file #ifndef NSHC_H #define NSHC_H #include "nc/tlist.h" #include "nc/cstr.h" #include "nc/cat.h" #include "nc/clamp.h" #include "nc/mem.h" #endif
Obviously the source code wont be released, because why giving for free something that is useful and required some effort to produce?
$ cd /Users/macbook/Documents/git/symta/nshc/src $ ls -l total 960 -rw-r--r--@ 1 macbook staff 176 Mar 11 13:10 cext.h drwxr-xr-x 8 macbook staff 256 Sep 19 19:11 cgrammar -rw-r--r--@ 1 macbook staff 1519 Mar 9 18:41 cnode.c -rw-r--r--@ 1 macbook staff 727 Mar 9 18:46 cnode.h -rw-r--r--@ 1 macbook staff 525 Mar 10 14:26 cnode_ids.h -rw-r--r--@ 1 macbook staff 75016 Mar 11 14:18 lexer.c -rw-r--r--@ 1 macbook staff 113 Mar 9 19:32 lexer.h -rw-rw-rw-@ 1 macbook staff 7339 Mar 10 23:03 lexer.l -rw-r--r--@ 1 macbook staff 1289 Mar 11 13:12 main.c -rw-r--r--@ 1 macbook staff 141999 Mar 11 14:18 parser.c -rw-r--r--@ 1 macbook staff 5454 Mar 11 14:18 parser.h -rw-rw-rw-@ 1 macbook staff 23167 Mar 10 14:43 parser.y -rw-r--r--@ 1 macbook staff 6179 Mar 11 13:11 patch.c -rw-r--r--@ 1 macbook staff 745 Mar 10 17:23 patch.h -rw-r--r--@ 1 macbook staff 15373 Mar 10 17:47 patchgen.c -rw-r--r--@ 1 macbook staff 94 Mar 9 21:22 patchgen.h -rw-r--r--@ 1 macbook staff 2591 Mar 11 13:11 sym.c -rw-r--r--@ 1 macbook staff 590 Mar 9 19:34 sym.h -rw-r--r--@ 1 macbook staff 1507 Mar 11 13:12 util.c -rw-r--r--@ 1 macbook staff 298 Mar 9 23:22 util.h -rw-r--r--@ 1 macbook staff 44786 Mar 11 13:12 wc.c -rw-r--r--@ 1 macbook staff 964 Mar 11 13:12 wc.l
14
Name:
Anonymous
2021-03-12 2:50
dangling pointers to myAnus
16
Name:
Anonymous
2021-03-12 8:19
>>8 Obviously the source code wont be released, because why giving for free something that is useful and required some effort to produce? That's why you'll always be an illegal bydlo in jail with moroccans.
18
Name:
Anonymous
2021-03-12 12:01
>>17 It's schizophrenic code. Keep it for yourself as it would probably cause the deads to walk among the living if it was widespread.
19
Name:
Anonymous
2021-03-12 12:08
This code would be absolutely DESTROYED at the eff. Numeric literals beyond 0 and maybe 1 are a sign of cancerous style.
20
Name:
Anonymous
2021-03-12 20:26
>>18 Yet it works well in practice. Here is how I use mAlloc to read a ply file, while making manual memory management manageable:
PLYObject *read_header(file_t *in) { auto hdr = new(PLYObject); PLYTable *table = 0; if (in.line.ne("ply")) return 0; int coloff; char *l; for (;;) { l = in.line; if (l.begins("end_header")) { break; } char *p = l; while (*p && *p != ' ') p++; *p = 0; p++; if (!table) { //header field? if (l.eq("format")) { hdr->format = p.dup; } else if (l.eq("comment")) { hdr->comment.push(p.dup); } else if (l.eq("element")) { goto element; } continue; } if (l.eq("element")) { element: coloff = 0; if (table) { table->row_size = coloff; } table = new(PLYTable); hdr->tbls.push(table); char *q = p; while (*q && *q != ' ') q++; *q = 0; q++; table->name = p.dup; table->nrows = q.asS32; } else if (l.eq("property")) { PLYColumn col; col.ctor; auto grp = mCurGrp(); mBegin(0); auto words = p.split(' '); mBegin(grp); //allocate at the level above if (words->elts[0].eq("list")) { col.name = words->elts[3].dup; auto t = ply_named_types.get(words->elts[1]); if (!t) { say("PLY: bad header type = ", words->elts[1]); return 0; } col.size_type = *t; t = ply_named_types.get(words->elts[2]); if (!t) { say("PLY: bad header type = ", words->elts[1]); return 0; } col.type = *t; col.off = coloff; coloff += sizeof(void*); //list will be a pointer } else { col.name = words->elts[1].dup; auto t = ply_named_types.get(words->elts[0]); if (!t) { say("PLY: bad header type = ", words->elts[0]); return 0; } col.type = *t; col.off = coloff; coloff += col.type->size; } table->cols.push(col); mEnd(); mEnd(); } } return hdr; }
21
Name:
Anonymous
2021-03-12 20:30
>>19 Numeric literals beyond 0 and maybe 1 are a sign of cancerous style. Incapable of remembering even your girlfriend's birthday date?
22
Name:
Anonymous
2021-03-12 20:55
>>21 I express dates, as all numbers, in Church numerals.
23
Name:
Anonymous
2021-03-12 21:30
>>20 This is what happens when fucktards don't stick with BASIC.
24
Name:
Anonymous
2021-03-12 23:07
25
Name:
Anonymous
2021-03-13 6:47
>>24 Why is the framework in Cyryllic on this websight? Please move to a western platform (something like Medium but without the cancer)
26
Name:
Anonymous
2021-03-13 13:01
>>25 I was banned from GitHub, Medium, Twitter and Reddit, after making anti-Russian posts. They said disliking Russians is racism, and they are against racism. I still don't get what is wrong with disliking the stupid and violent creatures.
27
Name:
Anonymous
2021-03-13 13:03
>>25 And that site, lj.rossia.org is basically a personal blog by Jewish Mathematician
https://en.wikipedia.org/wiki/Misha_Verbitsky but other people can create blogging accounts there too, and he doesn't care if if they write racist posts, because Misha has moved from US to Brazil, so they can't fire him for owning a racist site.
28
Name:
Anonymous
2021-03-13 17:09
>>26 Make a second read it account. Trivial and legal.
29
Name:
Anonymous
2021-03-13 18:17
>>28 They will ban it again, as soon as somebody reports it. I need a free speech platform, since I never censor myself.
31
Name:
Anonymous
2021-03-14 23:59
>>29 host on tor freenet or some shit
>>27 Shalom
!
34
Name:
Anonymous
2021-03-15 17:52
>>33 It's a 10 year old language supported by all C compilers now.