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

Pages: 1-

printf is too verbose and retarded of a name

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;
}

Name: Anonymous 2021-03-09 11:09

why does a printf replacement use printf?

Name: Anonymous 2021-03-09 11:45

>>2
Because unistd.h is not portable.

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.

Name: Anonymous 2021-03-11 4:17

>>4
Can we see the nsh.h file?

Name: glow 2021-03-11 11:08

nosuchheader.h

Name: Anonymous 2021-03-11 11:17

>>5
//NashC language main header file

#ifndef NSHC_H
#define NSHC_H

#include <stdint.h>
#include <stdlib.h>
#include <string.h>

@nc

#include "nsh/typedef.h"

#define NSH_NO_SWAP
#include "pp/defs.h"
#undef NSH_NO_SWAP

#define SWAP(x,y) do {auto t_ = x; x = y; y = t_;} while(0)


//#define LIKELY(x) (x)
//#define UNLIKELY(x) (x)

#include "nshc/clamp.h"

#define new(type) ((type*)malloc(sizeof(type))).ctor

#define delete(o) free((o).dtor)

#include "nshc/tlist.h"

#include "nshc/cat.h"

@end
#endif

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

Name: Anonymous 2021-03-11 19:17

Whats nashc?

Name: Anonymous 2021-03-11 21:06

>>9 https://gelbooru.com/index.php?page=post&s=view&id=3268176
Naughty
Arendelle
Sisters'
Hot
Cunnilingus

Name: Anonymous 2021-03-11 23:43

>>10
what is wrong with you?

Name: Anonymous 2021-03-11 23:59

Name: Anonymous 2021-03-12 0:19

>>12
Please poop on prog anus

Name: Anonymous 2021-03-12 2:50

dangling pointers to myAnus

Name: Anonymous 2021-03-12 6:19

(char*)mAlloc(l+1);

Anon, I...

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.

Name: Anonymous 2021-03-12 10:30

>>15
That is a special mAlloc, not your malloc.

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.

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.

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;
}

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?

Name: Anonymous 2021-03-12 20:55

>>21
I express dates, as all numbers, in Church numerals.

Name: Anonymous 2021-03-12 21:30

>>20
This is what happens when fucktards don't stick with BASIC.

Name: Anonymous 2021-03-12 23:07

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)

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.

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.

Name: Anonymous 2021-03-13 17:09

>>26
Make a second read it account. Trivial and legal.

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.

Name: Anonymous 2021-03-13 19:25

In 2012, Verbitsky was convicted without his knowledge of copyright infringement. He had posted a photograph of a Russian politician who claims that his beard is trademarked.[10] The case has been appealed.

Name: Anonymous 2021-03-14 23:59

>>29
host on tor freenet or some shit

>>27
Shalom!

Name: Anonymous 2021-03-15 12:05

Name: Anonymous 2021-03-15 13:59

>>32
It's C11 only,

No. Thanks.

Name: Anonymous 2021-03-15 17:52

>>33
It's a 10 year old language supported by all C compilers now.

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