1. Си / Говнокод #1407

    +108.1

    1. 1
    2. 2
    int i;
    if(i/2 == i - i/2) { ... }

    Тоже из лабораторки. Проверка на четность

    guest, 23 Июля 2009

    Комментарии (16)
  2. Си / Говнокод #1406

    +140

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    char *bukva="qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";
    char *cifra="1234567890";
    
    //тут получаем строку
    
    while((ch = getc(fp)) != EOF) {
        putc(ch,stdout);
        if(ch == ' ') {probel++; continue;}
        for (j = 0; j < (strlen(cifra)); j++) {
            if(ch == cifra[j])
                countcifra++;
        }
    
        for (j = 0;j < (strlen(bukva)); j++) {
            if(ch == bukva[j])
                countbukva++;
        }
     }

    Из лабораторки однокурсника. Подсчет количества букв и цифр в строке

    guest, 23 Июля 2009

    Комментарии (8)
  3. Си / Говнокод #1343

    +144.1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    #ifdef TYPE_A
    #define LEN 10
    #else
    #define LEN_9 9
    #endif
    
    #ifdef TYPE_A
    char str[LEN + 20];
    #else
    char str[LEN_9 + 20];
    #endif

    Макросня

    guest, 09 Июля 2009

    Комментарии (2)
  4. Си / Говнокод #1334

    +124.6

    1. 1
    #define Yield()

    winbase.h , строка 57.

    В Windows SDK, даже новом от Windows 7, присутствует заглушка для функции от Windows 3.x (1992 год). Эта заглушка мешает называть свои методы "Yield", никакой пользы при этом не принося - код от 3.х не дожил до этого года без изменений.

    guest, 07 Июля 2009

    Комментарии (7)
  5. Си / Говнокод #1319

    +138.6

    1. 1
    void (* signal(int __sig, void (* __func)(int))) (int)

    Объявление указателя на функцию, возращающей указатель на функцию из signal.h.

    Не говнокод, но прикольно:

    guest, 03 Июля 2009

    Комментарии (10)
  6. Си / Говнокод #1318

    +133.4

    1. 1
    2. 2
    3. 3
    #include <math.h>
     
    result = (use_cos ? cos : sin)(M_PI);

    Прогрессивно.

    guest, 03 Июля 2009

    Комментарии (5)
  7. Си / Говнокод #1317

    +138.2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if(true)
    {
      //Код
    }
    else
    {
      //Закомментированно, но компилируется. ^_^
    };

    Способ комментирования... O_o

    guest, 03 Июля 2009

    Комментарии (8)
  8. Си / Говнокод #1279

    +144

    1. 1
    duff device

    Сами знаете код.
    Остальное из классики вроде #define TRUE FALSE и оператора передёргивания уже тут было.

    guest, 28 Июня 2009

    Комментарии (0)
  9. Си / Говнокод #1275

    +141

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    typedef INTEGER int
    typedef BOOLEAN bool
    #define TRUE true
    #define FALSE false
    #define BEGIN {
    #define END }
    #define WHILE(a) while(a)
    #define REPEAT do{
    #define UNTIL(a) }while(!(a))
    #define FOR for(
    #define TO(a,b) ,a<b
    #define DO(a) ,a++)
    #define VAR
    #define IF if
    #define THEN
    ...
    VAR
    INTEGER I;
    BEGIN
    I=2;
    REPEAT
    ...
    I=I+1;
    UNTIL I<5;
    ...
    END
    ...

    Что этот парень пытался сделать с Си? O_o

    guest, 28 Июня 2009

    Комментарии (21)
  10. Си / Говнокод #1274

    +122.4

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    /* sent by Stephan Hughson - 2003 */
    /* must be compiled with cc or g++*/
    
    #include <stdio.h>
    
    int main(int t,int _,char*a)
    {return!0<t?t<3?main(-79,-13,a+main(-87,1-_,
    main(-86, 0, a+1 )+a)):1,t<_?main(t+1, _, a ):3,main ( -94, -27+t, a
    )&&t == 2 ?_<13 ?main ( 2, _+1, "%s %d %d\n" ):9:16:t<0?t<-72?main(_,
    t,"@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l,+,/n{n+\
    ,/+#n+,/#;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l q#'+d'K#!/\
    +k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;# ){n\
    l]!/n{n#'; r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#\
    n'wk nw' iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c \
    ;;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;\
    #'rdq#w! nr'/ ') }+}{rl#'{n' ')# }'+}##(!!/")
    :t<-50?_==*a ?putchar(a[31]):main(-65,_,a+1):main((*a == '/')+t,_,a\
    +1 ):0<t?main ( 2, 2 , "%s"):*a=='/'||main(0,main(-61,*a, "!ek;dc \
    i@bK'(q)-[w]*%n+r3#l,{}:\nuwloca-O;m .vpbks,fxntdCeghiry"),a+1);}

    Вот результат работы программы(всё не вместилось):
    On the first day of Christmas my true love gave to me
    a partridge in a pear tree.

    On the second day of Christmas my true love gave to me
    two turtle doves
    and a partridge in a pear tree.

    ...

    On the eighth day of Christmas my true love gave to me
    eight maids a-milking, seven swans a-swimming,
    six geese a-laying, five gold rings;
    four calling birds, three french hens, two turtle doves
    and a partridge in a pear tree.

    On the ninth day of Christmas my true love gave to me
    nine ladies dancing, eight maids a-milking, seven swans a-swimming,
    six geese a-laying, five gold rings;
    four calling birds, three french hens, two turtle doves
    and a partridge in a pear tree.

    On the tenth day of Christmas my true love gave to me
    ten lords a-leaping,
    nine ladies dancing, eight maids a-milking, seven swans a-swimming,
    six geese a-laying, five gold rings;
    four calling birds, three french hens, two turtle doves
    and a partridge in a pear tree.

    On the eleventh day of Christmas my true love gave to me
    eleven pipers piping, ten lords a-leaping,
    nine ladies dancing, eight maids a-milking, seven swans a-swimming,
    six geese a-laying, five gold rings;
    four calling birds, three french hens, two turtle doves
    and a partridge in a pear tree.

    On the twelfth day of Christmas my true love gave to me
    twelve drummers drumming, eleven pipers piping, ten lords a-leaping,
    nine ladies dancing, eight maids a-milking, seven swans a-swimming,
    six geese a-laying, five gold rings;
    four calling birds, three french hens, two turtle doves
    and a partridge in a pear tree.

    guest, 28 Июня 2009

    Комментарии (36)