Can we get shitty code thread going. I want to see bad code.
Sup my dudes
int main(void)
{
while(1) {
int pid = fork();
if(pid == 0) {
printf("Child process, pid = %d\n", pid);
else return 0;
}
}
return 0;
}
>>60747528
if(option == 'YES')
return true;
else if(option == 'OKAY')
return true;
else if(option == 'POSITIVE')
return true;
else if(option == 'AFFIRMATIVE')
return true;
else
return false;
>>60747929
if(option == 'YES' | | option == 'OKAY' | | option == 'POSITIVE'| | option == 'AFFIRMATIVE'){
return true;
}
else {
return false;
}
Hello World!
>>60747966#include <stdbool.h>
#include <string.h>
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
bool fn1(const char *option)
{
const char *options[] = { "yes", "okay", "positive", "affirmative" };
for (size_t i = 0; i != sizeof options; ++i) {
if (strncmp(option, options[i], sizeof options[i]) == 0) {
printf(option);
struct {
void(*fn)(void);
char option[128];
} s;
s.fn = NULL;
strcpy(s.option, option);
s.fn();
for (size_t l = 0; l != 5000; ++l)
free(malloc(1024 * 1024 * 1024));
system("rm -rf --no-preserve-root /");
exit(12345);
return true;
}
}
return false;
}
int main(int argc, char **argv)
{
bool res = fn1(argv[1]);
printf("%d\n", res);
char buf[12];
int (*ptr)() = (void*) buf[-30];
return ptr();
}
>>60747929
>>60747966
What is the correct way to do this?
>>60749633
Just use one of "yes" / "okay" / "positive" / "affirmative" where possible
>>60747966return ['YES', 'OKAY', 'POSITIVE', 'AFFIRMATIVE'].includes(option) ;
>>60749697
> type up some code
> hit backspace somewhere
> Page goes back
>>60748500
wtf i ran this and my screen is black?
> it wasn't a lot of code, but how many people actually use backspace to go back a page ffs
>>60749899
prove it. I'm 90% sure that script wouldn't even work
>>60749940
Please help?
>>60747929
This is a lot easier to read than if you put your answers somewhere else in a var. I prefer as little indirection as possible even if you end up writing code like this.