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

Code Thread

Name: Anonymous 2018-02-23 0:05

This place has gone from programming themed garbage to just garbage. Post code. Any clean code. Here's a C function to remove whitespace.

void remove_whitespace(char *s) {
char *i = s;
do
if(!isspace(*i = *s))
++i;
while(*s++);
}

Name: Anonymous 2018-03-21 10:31

HANDLE MY ANUS

Name: Anonymous 2018-03-21 12:39

>>37
it was trickier than I thought (with some annoying edge cases) but overall not too bad.
#include <stdio.h>
#include <stdlib.h>

char str[5] = {'a','a','a','a','a'};
int currchar=0, endchar=0, ignore=0;

void a_to_y(){
str[4-currchar]++;
currchar = 0;
}

void z_standard(){
str[4-currchar++]='a';
ignore++;
}

void z_end(){
str[0]='a';
str[1]='a';
str[2]='a';
str[3]='a';
str[4]='a';
endchar++;
currchar=0;
}

void (*handle_z[5])() = {z_end, z_standard, z_standard, z_standard, z_standard};

void z(){
(*handle_z[endchar-currchar])();
}

void (*handle_char[2])() = {a_to_y, z};
short handle_char_internal[26] = {0};

void do_print(char* s){
puts(s);
}

void do_not_print(char* s){
ignore--;
}

void (*printers[5])(char* s) = {do_print, do_not_print, do_not_print, do_not_print, do_not_print};

void (*printer)(char* s) = do_print;

void set_printer(){
printer = printers[ignore];
}

void nop(){}

void end(){
exit(0);
}

void (*on_new_endchar[6])() = {nop, nop, nop, nop, nop, end};

int main(){
handle_char_internal[25] = 1;
ass:
set_printer();
(*printer)(&str[4-endchar]);
(*on_new_endchar[endchar])();
(*handle_char[handle_char_internal[str[4-currchar]-'a']])();
goto ass;
}

Name: Anonymous 2018-03-21 14:39

>>42
Hope you didn't waste your precious work/neet time

Name: Anonymous 2018-03-21 14:43

I wasn't doing anything important anyway. also, check'em

Name: Anonymous 2018-03-21 16:37

There exist only 4 unary operations on binary input: invert (A->!A), maintain (A->A), nullify (A->0), validate (A->1).
Yet, nullify and validate can be thought of as nullary operations, merely inherited into unary space. Likewise, in binary operations, analogues to the (strictly) unaries exist, like maintain first (A,B->A), maintain second (A,B->B), invert first (A,B->!A) and invert second (A,B->!B).

Name: Anonymous 2018-03-21 18:07

>>32
Switch is a conditional idiot.

Name: Anonymous 2018-03-21 18:55

>>46
And you didn't see the if just after it? :/

Name: Anonymous 2018-03-22 7:50

>>46
ackchyually, switch is more like a computed goto (unfortunately, C lacks true computed goto). but I knew that someone will complain about it, that's why I made >>34. it even validates command-line arguments without conditionals!

Name: Anonymous 2018-03-22 13:20

>>48
switch is more like a computed goto
it's still a conditional

Name: Anonymous 2018-03-22 13:36

>>49
your're are mom is unconditionally a whore

Name: Anonymous 2018-03-22 14:01

>>50
#include<stdio.h>#include<stdlib.h>charstr[5]={'a','a'
,'a','a','a'};intcurrchar=0,endchar=0,ignore=0;voida_to_y()
{str[4-currchar]++;currchar=0;}voidz_standard(){str[4-currchar
++]='a';ignore++;}voidz_end(){str[0]='a';str[1]='a';str[2]='a';str[
3]='a';str[4]='a';endchar++;currchar=0;}void(*handle_z[5])()={z_end,z_
standard,z_standard,z_standard,z_standard};voidz(){(*handle_z[endchar-cu
rrchar])();}void(*handle_char[2])()={a_to_y,z};shorthandle_char_internal[2
6]={0};voiddo_print(char*s){puts(s);}voiddo_not_print(char*s){ignore--;}void
(*printers[5])(char*s)={do_print,do_not_print,do_not_print,do_not_print,do_not
_print};void(*printer)(char*s)=do_print;voidset_printer(){printer=printers[igno
re];}voidnop(){}voidend(){exit(0);}void(*on_new_endchar[6]) ()={nop,nop,nop,nop,n
op,end};intmain(){handle_char_inter nal[25]=1;ass:set_print er();(*printer)(&str[
4-endchar]);(*on_new_endchar[ endch ar])();(*handle_char[ha ndle_char_internal[s
tr[4-currchar]-'a']])();goto ass;} #include<stdio.h># incl ude<stdlib.h>charstr
[5]={'a','a','a','a','a'};intcurrchar=0,endchar=0,ignore=0;voida_to_y(){str[4-currch
ar]++;currchar=0;}voidz_sta nda rd(){str[4-currc har ++]='a';ignore++;}
voidz_end(){str[0]='a';st r[ 1]='a';str[2]=' a' ;str[3]='a';str [
4]='a';endchar++;currchar =0 ;}void(*handl e_ z[5])()={z_end ,
z_standard,z_standard,z_s tanda rd, z_standard} ; voidz(){(*han
dle_z[endchar-currchar])();}void(*handle _c har[2] )()={a_to_y ,z};shorthand
le_char_internal[26]={0} ;voiddo_print( ch ar*s ){puts(s);} voiddo_not_p
rint(char*s){ignore--; } void(*print er s[5])(ch ar*s)={do_pr
i nt,do_not_print,do_n o t_print,do_ n ot_print , do_not_prin
t };void(*printer)(char *s)=do_pri nt;voids et_printer(
) {printer=printers[ig nore];}vo idnop() {}voidend()
{ exit(0);}void(*on _n ew_endc har[6] )()={nop,nop
,nop,nop,nop,end} ;intmain(){h
andle_char_inter nal[25]=1
;ass:set_printer ();(*prin
ter)(&str[4-end char]);(*o
n_new_endchar[ endchar])
();(*handle_c har[handle
_char_internal [str[4-cu
rrchar]-'a']])( );goto ass;}#incl
u de<stdio.h>#incl ude<stdl ib.h>charst
r[5]={'a','a','a', 'a' ,'a'}; in
tcurrchar=0,endchar=0 ,ign ore= 0;
voida_to_y(){str[4-currch ar]++;c urrc h
ar=0;}voidz_standard(){str[4-currchar++]= 'a'
;ignore++;}voidz_end(){str[0]='a';str[1]= 'a
';str[2]='a';str[3]='a';str[4]='a';endcha
r++ ;currchar=0;}void(*handle_z[5])()={z_e
n d,z_standard,z_standard,z_standard,z_s
tandard};vo idz(){(*handle_ z[endchar
-currchar])();} void(*han d le_char[2]
)()={a_to_y,z};short handle_char_in
ternal[26]={0};voiddo_prin t(char*s){puts(s);}
voiddo_not_print(char*s){ignore--; }void(*printers[5])(char*
s)={do_print,do_not_print,do_not_ p rint,do_ not_print,do_not_print}
;void(*printer)(char*s)=do_pr int;voidset_printer(){printer=printe
rs[i gnore];}voidnop(){}voidend(){ exit(0);}void(*on_n ew_

Name: Anonymous 2018-03-22 14:05

>>49
It's a computed goto based on a conditional you fucking chode just like every other control staIHSBT

Name: Anonymous 2018-03-22 14:05

>>51
I don't think this will compile

Name: Anonymous 2018-03-22 18:08

>>53
Then you're not trying hard enough.

Name: Anonymous 2018-03-22 20:47

>>51
I enjoyed reading this.

Name: Anonymous 2018-03-22 22:28

>>8
There's a definition for the max length of *argv though, so I'm not sure that's a good example.

Name: Anonymous 2018-04-02 11:14

A script for copying favorited photos from your iOS device
#!/bin/sh
## https://brew.sh on macOS
# brew install libimobiledevice
# brew cask install osxfuse
# brew install ifuse
## or compile from http://www.libimobiledevice.org for Linux and Windows
## plug in your iOS device
## give your computer access
# idevicepair pair
## mount your iOS device's filesystem
# ifuse ~/iPhone

in=~/iPhone
out=~/Pictures/iPhone\ Favorites
mkdir -p "$out"

echo "SELECT ZDIRECTORY || '/' || ZFILENAME FROM ZGENERICASSET WHERE ZFAVORITE = 1;" \
| sqlite3 "$in/PhotoData/Photos.sqlite" \
| rsync -aP --files-from=- "$in" "$out"

Name: Anonymous 2018-04-03 11:04

#include <iostream>
using namespace std;

int main()
{
cout << "Hello, World!";
return 0;
}

Name: Anonymous 2018-04-03 16:36

echo 'hello world';

Name: Anonymous 2018-04-03 16:36

FUK this thred

Name: Anonymous 2018-04-03 17:59

>>60
HAX MY ANGUS

Name: Anonymous 2018-04-04 0:02

>>58
Why did you use an overloaded operator to print something to stdout?

Name: Anonymous 2018-04-04 6:22

>>62
OVERLOAD MY ANUS!!!!

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