瀏覽代碼

base: hide an old warning from the GCC optimiser.

undefined
Sam Hocevar 8 年之前
父節點
當前提交
42e56399d4
共有 1 個檔案被更改,包括 4 行新增3 行删除
  1. +4
    -3
      src/lol/base/string.h

+ 4
- 3
src/lol/base/string.h 查看文件

@@ -67,16 +67,17 @@ public:
inline char &operator [](int n)
{
/* Allow n == count() because we might have reasonable reasons
* to access that hidden null character. */
* to access that hidden null character. We cast to unsigned so
* as to avoid a harmless message from the GCC optimiser. */
ASSERT(n >= 0);
ASSERT(n <= count());
ASSERT((unsigned)n <= (unsigned)count());
return ((super &)*this)[n];
}

inline char const &operator [](int n) const
{
ASSERT(n >= 0);
ASSERT(n <= count());
ASSERT((unsigned)n <= (unsigned)count());
return ((super const &)*this)[n];
}



Loading…
取消
儲存