Няшная / Говнокод #28556 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
switch(argCount)
	{
		case 0: sprintf(dst, fmt); break;
		case 1: sprintf(dst, fmt, args[0]); break;
		case 2: sprintf(dst, fmt, args[0], args[1]); break;
		case 3: sprintf(dst, fmt, args[0], args[1], args[2]); break;
		case 4: sprintf(dst, fmt, args[0], args[1], args[2], args[3]); break;
		case 5: sprintf(dst, fmt, args[0], args[1], args[2], args[3], args[4]); break;
		case 6: sprintf(dst, fmt, args[0], args[1], args[2], args[3], args[4], args[5]); break;
		case 7: sprintf(dst, fmt, args[0], args[1], args[2], args[3], args[4], args[5], args[6]); break;
		case 8: sprintf(dst, fmt, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]); break;
		...

Запостил: GAMER GAMER, (Updated )

Комментарии (30) RSS

  • Такую хуйню можно на ассемблере написать намного лучше
    Ответить
    • ого
      напиши пожалуйста sprintf на асемблере.

      или ты просто про вызов готового? тогда простота зависит от колконвеншена
      Ответить
      • Вывоз, конечно же. Впрочем, даже на няшной несложно собрать свой varargs с язычеством и деревянными цирквями.
        Ответить
      • зачем извращаться с встроенным говном, не проще ли передать параметры через конкатенацию?
        Ответить
  • Ten "safe C" commandments to remember...
    1. Restrict to simple control flow constructs. Do not use goto statements, setjmp, longjmp, or recursion.
    2. Give all loops a fixed upper-bound.
    3. Do not use dynamic memory allocation after initialization.
    4. Limit functions to no more than 60 lines of text.
    5. Use minimally 2 assertions for every function of more than 10 lines.
    6. Declare data objects at the smallest possible level of scope.
    7. Check the return value of all non-void functions, and check the validity of all function parameters.
    8. Limit the use of the preprocessor to file inclusion and simple macros.
    ...

    9. Limit the use of pointers. Use no more than 1 level of dereferencing per expression.
    10. Compile with all warnings enabled, in pedantic mode, and use one or more modern static source code analyzers.
    Ответить
  • sprintf(dst, fmt, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);

    Fixed.
    Ответить
    • Так там продолжение есть.

      case 9: sprintf(dst, fmt, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]); break;
      Ответить

Добавить комментарий

Семь раз отмерь — один отрежь, guest!

    А не использовать ли нам bbcode?


    8