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:12

>>31
no fake, but when you only use one compiler and not adding to some open source project let alone a private one they don't care.

>>27
1==1
no it doesn't, that would have to be the stupidest compiler ever to even assemble to that.


[ @ ~/host/prog/story ] $ cat st.c
#include <stdio.h>

void forloop(void)
{
    int i;
    for(i=0;i==8;++i)
        continue;
}

void whileloop(void)
{
    int i = 0;
    while(1){
        i+=2;
        if(i == 8)
            break;
    }
}


int main()
{
    forloop();
    whileloop();
}
[ Mon Dec 26 12:08:40 ]
[ @ ~/host/prog/story ] $ cat st.s
    .file    "st.c"
    .text
.globl forloop
    .type    forloop, @function
forloop:
.LFB0:
    .cfi_startproc
    pushq    %rbp
    .cfi_def_cfa_offset 16
    movq    %rsp, %rbp
    .cfi_offset 6, -16
    .cfi_def_cfa_register 6
    //int i = 0;
    movl    $0, -4(%rbp)
    jmp    .L2
.L3:
    //++i
    addl    $1, -4(%rbp)
.L2:
    //i==8
    cmpl    $8, -4(%rbp)
    je    .L3//continue
    leave
    ret
    .cfi_endproc
.LFE0:
    .size    forloop, .-forloop
.globl whileloop
    .type    whileloop, @function
whileloop:
.LFB1:
    .cfi_startproc
    pushq    %rbp
    .cfi_def_cfa_offset 16
    movq    %rsp, %rbp
    .cfi_offset 6, -16
    .cfi_def_cfa_register 6
    //int i = 0;
    movl    $0, -4(%rbp)
    jmp    .L7
.L9: //while(1)
    nop
.L7:
    //i+=2;
    addl    $2, -4(%rbp)
    //i==8?
    cmpl    $8, -4(%rbp)
    jne    .L9//i!=8
    nop
    leave
    ret
    .cfi_endproc
.LFE1:
    .size    whileloop, .-whileloop
.globl main
    .type    main, @function
main:
.LFB2:
    .cfi_startproc
    pushq    %rbp
    .cfi_def_cfa_offset 16
    movq    %rsp, %rbp
    .cfi_offset 6, -16
    .cfi_def_cfa_register 6
    call    forloop
    call    whileloop
    leave
    ret
    .cfi_endproc
.LFE2:
    .size    main, .-main
    .ident    "GCC: (Debian 4.4.5-8) 4.4.5"
    .section    .note.GNU-stack,"",@progbits

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