arraysize_unsafe.h 1.1 KB

12345678910111213141516171819202122232425262728
  1. // Copyright 2016 The Crashpad Authors. All rights reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #ifndef CRASHPAD_UTIL_MISC_ARRAYSIZE_UNSAFE_H_
  15. #define CRASHPAD_UTIL_MISC_ARRAYSIZE_UNSAFE_H_
  16. //! \file
  17. //! \brief Not the safest way of computing an array’s size…
  18. //!
  19. //! `#%include "base/macros.h"` and use its `arraysize()` instead. This macro
  20. //! should only be used in rare situations where `arraysize()` does not
  21. //! function.
  22. #define ARRAYSIZE_UNSAFE(array) (sizeof(array) / sizeof(array[0]))
  23. #endif // CRASHPAD_UTIL_MISC_ARRAYSIZE_UNSAFE_H_