IntegerPrintfMacros.h 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. /* Implements the C99 <inttypes.h> interface. */
  6. #ifndef mozilla_IntegerPrintfMacros_h_
  7. #define mozilla_IntegerPrintfMacros_h_
  8. /*
  9. * These macros should not be used with the NSPR printf-like functions or their
  10. * users, e.g. mozilla/Logging.h. If you need to use NSPR's facilities, see the
  11. * comment on supported formats at the top of nsprpub/pr/include/prprf.h.
  12. */
  13. /*
  14. * scanf is a footgun: if the input number exceeds the bounds of the target
  15. * type, behavior is undefined (in the compiler sense: that is, this code
  16. * could overwrite your hard drive with zeroes):
  17. *
  18. * uint8_t u;
  19. * sscanf("256", "%" SCNu8, &u); // BAD
  20. *
  21. * For this reason, *never* use the SCN* macros provided by this header!
  22. */
  23. #include <inttypes.h>
  24. #endif /* mozilla_IntegerPrintfMacros_h_ */