michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* Implements the C99 interface, minus the SCN* format macros. */ michael@0: michael@0: #ifndef mozilla_IntegerPrintfMacros_h_ michael@0: #define mozilla_IntegerPrintfMacros_h_ michael@0: michael@0: /* michael@0: * MSVC++ doesn't include , even in versions shipping , so michael@0: * we have to reimplement it there. Note: #includes . michael@0: * michael@0: * Note that this header DOES NOT implement 's scanf macros. MSVC's michael@0: * scanf doesn't have sufficient format specifier support to implement them michael@0: * (specifically, to implement scanning into an 8-bit location). michael@0: * michael@0: * http://stackoverflow.com/questions/3036396/scanfd-char-char-as-int-format-string michael@0: * michael@0: * Moreover, scanf is a footgun: if the input number exceeds the bounds of the michael@0: * target type, behavior is undefined (in the compiler sense: that is, this code michael@0: * could overwrite your hard drive with zeroes): michael@0: * michael@0: * uint8_t u; michael@0: * sscanf("256", "%" SCNu8, &u); // BAD michael@0: * michael@0: * This header will sometimes provide SCN* macros, by dint of being implemented michael@0: * using . But for these reasons, *never* use them! michael@0: */ michael@0: michael@0: #if defined(MOZ_CUSTOM_INTTYPES_H) michael@0: # include MOZ_CUSTOM_INTTYPES_H michael@0: #elif defined(_MSC_VER) michael@0: # include "mozilla/MSIntTypes.h" michael@0: #else michael@0: # include michael@0: #endif michael@0: michael@0: #endif /* mozilla_IntegerPrintfMacros_h_ */