Allow the use of PRId64, PRIu64 and PRIx64 printf formating macros globally.
authorMario de Sousa <msousa@fe.up.pt>
Thu, 30 Aug 2012 13:04:30 +0100
changeset 645 e01ede1c9862
parent 644 e7ac0fe9a287
child 646 dd76ce4a7e22
Allow the use of PRId64, PRIu64 and PRIx64 printf formating macros globally.
main.hh
--- a/main.hh	Wed Aug 29 21:52:33 2012 +0100
+++ b/main.hh	Thu Aug 30 13:04:30 2012 +0100
@@ -48,8 +48,6 @@
 
 
 
-
-
  /* Get the definition of INT16_MAX, INT16_MIN, UINT64_MAX, INT64_MAX, INT64_MIN, ... */
 
 #define __STDC_LIMIT_MACROS /* required to have UINTxx_MAX defined when including stdint.h from C++ source code. */
@@ -122,6 +120,13 @@
 
 
 
+/* get the printf format macros for printing variables of fixed data size
+ * e.g.  int64_t v; printf("value=%"PRId64" !!\n", v);
+ * e.g. uint64_t v; printf("value=%"PRIu64" !!\n", v);
+ * e.g. uint64_t v; printf("value=%"PRIx64" !!\n", v);  // hexadecimal format
+ */
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
 
 
 #endif // #ifndef _MAIN_HH
\ No newline at end of file