Кресты / Говнокод #25219 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
luabind::object FlowerEventModel::RewardInfo(int index) const {
		luabind::object result = luabind::newtable(Core::luaState);
		if (index < 0 && index >= (int)_presents.size()) {
			return result;
		}
		return result;
	}

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

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

  • Пофиксил, проверь:
    if (index < 0 && index >= (int)_presents.size()) {
        return result;
    } else if (index >= 0 || index < (int)_presents.size()) {
        return result;
    } else {
        throw new WhatTheFuckException();
    }
    return result;
    Ответить
    • <pre>
      try {
      if (index < 0 && index >= (int)_presents.size()) {
      return result;
      } else if (index >= 0 || index < (int)_presents.size()) {
      return result;
      } else {
      throw WhatTheFuckException();
      }
      return result;
      } catch {
      return result;
      }

      return result;
      </pre>
      Ответить
  • >index < 0 && index >= (int)_presents.size()
    Не, ну если index отрицательный, а _presents.size() возвращает беззнаковое целое, скажем, 0x80000000U...
    Ответить

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

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

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


    8