| Index: base/basictypes.h
|
| ===================================================================
|
| --- base/basictypes.h (revision 6919)
|
| +++ base/basictypes.h (working copy)
|
| @@ -102,7 +102,7 @@
|
| //
|
| // One caveat is that arraysize() doesn't accept any array of an
|
| // anonymous type or a type defined inside a function. In these rare
|
| -// cases, you have to use the unsafe ARRAYSIZE() macro below. This is
|
| +// cases, you have to use the unsafe ARRAYSIZE_UNSAFE() macro below. This is
|
| // due to a limitation in C++'s template system. The limitation might
|
| // eventually be removed, but it hasn't happened yet.
|
|
|
| @@ -122,26 +122,26 @@
|
|
|
| #define arraysize(array) (sizeof(ArraySizeHelper(array)))
|
|
|
| -// ARRAYSIZE performs essentially the same calculation as arraysize,
|
| +// ARRAYSIZE_UNSAFE performs essentially the same calculation as arraysize,
|
| // but can be used on anonymous types or types defined inside
|
| // functions. It's less safe than arraysize as it accepts some
|
| // (although not all) pointers. Therefore, you should use arraysize
|
| // whenever possible.
|
| //
|
| -// The expression ARRAYSIZE(a) is a compile-time constant of type
|
| +// The expression ARRAYSIZE_UNSAFE(a) is a compile-time constant of type
|
| // size_t.
|
| //
|
| -// ARRAYSIZE catches a few type errors. If you see a compiler error
|
| +// ARRAYSIZE_UNSAFE catches a few type errors. If you see a compiler error
|
| //
|
| // "warning: division by zero in ..."
|
| //
|
| -// when using ARRAYSIZE, you are (wrongfully) giving it a pointer.
|
| -// You should only use ARRAYSIZE on statically allocated arrays.
|
| +// when using ARRAYSIZE_UNSAFE, you are (wrongfully) giving it a pointer.
|
| +// You should only use ARRAYSIZE_UNSAFE on statically allocated arrays.
|
| //
|
| // The following comments are on the implementation details, and can
|
| // be ignored by the users.
|
| //
|
| -// ARRAYSIZE(arr) works by inspecting sizeof(arr) (the # of bytes in
|
| +// ARRAYSIZE_UNSAFE(arr) works by inspecting sizeof(arr) (the # of bytes in
|
| // the array) and sizeof(*(arr)) (the # of bytes in one array
|
| // element). If the former is divisible by the latter, perhaps arr is
|
| // indeed an array, in which case the division result is the # of
|
| @@ -223,7 +223,7 @@
|
| // expression is true. For example, you could use it to verify the
|
| // size of a static array:
|
| //
|
| -// COMPILE_ASSERT(ARRAYSIZE(content_type_names) == CONTENT_NUM_TYPES,
|
| +// COMPILE_ASSERT(ARRAYSIZE_UNSAFE(content_type_names) == CONTENT_NUM_TYPES,
|
| // content_type_names_incorrect_size);
|
| //
|
| // or to make sure a struct is smaller than a certain size:
|
|
|