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

c code story

Name: Anonymous 2011-12-25 0:50

this one time i went to these guys and i wall all "hey guys check out my c code" and they were all "dude your code sucks" and i was all "no dude nothing is wrong with my code" and then the guy was all "you used a break statement in nested while loops" so i said to him i says "dude thats totally legit" and hes all "dude your noob programmer if you compile that in a very specific way then there is a chance that the code wont work" so i told him right to his face that he is a faggot and wrong because my code worked and i didn't care if it wouldn't work compiled that way because maybe i won't compile it that way

and thats my story i hope you enjoyed it

Name: Anonymous 2011-12-26 0:39

>>40
Stop relying on a for loop for a shitty wait/sleep implementation.

Name: Anonymous 2011-12-26 0:45

>>40

you would have to tune parameters of the loop depending on the architecture, so may as well go to the assembly level for that.

Name: Anonymous 2011-12-26 0:47

>>42
er, processor.

Name: Anonymous 2011-12-26 7:31


#define BeginProgram void main(int argc, char *argv[])
#define CloseBrace }
#define CommandLineArgument -1
#define Declare int i,j,n,Flag=1;
#define EndOfProgram return;
#define False 0;
#define ForLoop ;for
#define GetCommandLineArgument n=atoi(argv[1]);
#define i F1ag
#define If if
#define Increment ++
#define Is ==
#define LessThan *(c&64)*
#define LessThanOrEqualTo !=
#define Modulo %
#define OpenBrace {
#define PossibleFactor j
#define PossiblePrime i
#define Possib1ePrime (c=getchar())
#define PrimeNumber (c^(!i*n%64));
#define Print putchar
#define SetTo =
#define SmallestPrime 2
#define True 1
#define Variables char c;
#define Zero i%j

BeginProgram
OpenBrace
    Declare Variables
    GetCommandLineArgument

    ForLoop (PossiblePrime SetTo SmallestPrime ;
             Possib1ePrime LessThanOrEqualTo CommandLineArgument ;
             Increment PossiblePrime)
    OpenBrace
        F1ag SetTo True
        ForLoop (PossibleFactor SetTo SmallestPrime ;
                 PossibleFactor LessThan PossiblePrime ;
                 Increment PossibleFactor)
            If (PossiblePrime Modulo PossibleFactor Is Zero)
                F1ag SetTo False

        If (Flag Is True)
            Print PrimeNumber
    CloseBrace

    EndOfProgram
CloseBrace

Name: Anonymous 2011-12-26 9:34

#define i F1ag

Name: Anonymous 2011-12-26 14:22

>>44
; inside the code story

looks ugly, would not fuck.

Name: Anonymous 2011-12-26 14:38

>>44'
#define PossibleFactor j
#define PossiblePrime i
#define Modulo %
#define Is ==
#define Zero i%j
>If (PossiblePrime Modulo PossibleFactor Is Zero)

=> if (i % j == i % j)


good code you go there

Name: Anonymous 2011-12-26 14:44


#define procedure void
#define main:(int,a0...an) main(int argc,char* argv*){
#define for for(int
#define SmallestPrime 2
#define -> ;i<
#define a(x) atoi(argv[x])+1
#define do ; {
#define end }
#define if(
#define then ){
#define mod %
#define is ==
#define := =
#define var int
#define isnt !=
#define and &&
#define or ||
#define print putchar(x);

procedure main:(int,a0...an)
  for i := SmallestPrime -> a(1) do
    var flag := 0
    for j := SmallestPrime -> sqrt(i) do
      if j isnt i and i % j is 0 then
        flag := 1
      end
    end
    if flag is 0 then
      print(i)
    end
  end
end

Name: Anonymous 2011-12-26 20:03

>>9
asm
Syntax error, ``faggot''.

Name: Anonymous 2011-12-26 20:15

>>34
#NO_APP
        .file   "st.c"
        .section        .rodata.str1.1,"aMS",@progbits,1
.LC0:
        .string ">>33 is a faggot"
        .text
        .align 1
.globl whileloop
        .type   whileloop, @function
whileloop:
        .word 0x40
        subl2 $4,%sp
        clrl %r6
.L2:
        pushab .LC0
        calls $1,puts
        addl2 $2,%r6
        cmpl %r6,$8
        jneq .L2
        ret
        .size   whileloop, .-whileloop
        .align 1
.globl forloop
        .type   forloop, @function
forloop:
        .word 0x40
        subl2 $4,%sp
        clrl %r6
.L8:
        pushab .LC0
        calls $1,puts
        addl2 $2,%r6
        cmpl %r6,$8
        jneq .L8
        ret
        .size   forloop, .-forloop
        .align 1
.globl main
        .type   main, @function
main:
        .word 0x0
        subl2 $4,%sp
        calls $0,forloop
        calls $0,whileloop
        ret
        .size   main, .-main
        .ident  "GCC: (GNU) 4.1.3 20080704 prerelease (NetBSD nb2 20081120)"

Name: Anonymous 2012-10-25 4:07

Was the consensus that it's ok to use break in nested while loops?

Name: Anonymous 2012-10-25 4:28

>>51
It is better to use a family of tail recursive functions that get compiled to jumps within the local call frame

Name: Lambda A Calculus 2012-10-25 10:51

>>13
U AIN'T RED DA STANDARD


If the return type of the main function is a type compatible with int, a return from the
initial call to the main function is equivalent to calling the exit function with the value
returned by the main function as its argument;10) reaching the } that terminates the
main function returns a value of 0. If the return type is not compatible with int, the
termination status returned to the host environment is unspecified.

Name: Anonymous 2012-10-25 11:03

>>53
This tells me that it would be safer to call EXIT_SUCCESS, in case the environment is expecting something other than an integer. I agree that it would be an extremely rare case, though.

Name: Anonymous 2012-10-25 12:57

>>54
EXIT_SUCCESS is a preprocessor macro of type int.

Name: Anonymous 2012-10-25 13:08

(Holy shit, I remember posting >>9,12. Man, I thought this thread was from 2009 or something, really. Guess time doesn't really fly at all.)

Name: Anonymous 2012-10-25 13:15

>>56
So you've been visiting prog for a year. How sad.

Name: Anonymous 2012-10-25 16:18

>>52
Redesign this program


for(i = 0; i < 10; i++) {
  while(a) {
    a = f();
    if(g(a))
      break;
  }
}

Name: Anonymous 2012-10-25 16:22

LISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISP
LISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISP
LISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISP
LISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISP
LISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISP
LISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISP
LISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISP
LISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISP
LISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISP
LISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISPLISP

Name: Anonymous 2012-10-25 16:23

COMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICE
COMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICE
COMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICE
COMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICE
COMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICE
COMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICE
COMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICE
COMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICE
COMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICE
COMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICE

Name: Anonymous 2012-10-25 16:24

COMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICECOMMON LISP FOR GREAT JUSTICE

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